Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
0bac5a1b
Commit
0bac5a1b
authored
7 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
log the total cost of the call to threadpool_map as thread id -1.
parent
0de74269
No related branches found
No related tags found
1 merge request
!375
Threadpool task plots
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/threadpool.c
+11
-5
11 additions, 5 deletions
src/threadpool.c
with
11 additions
and
5 deletions
src/threadpool.c
+
11
−
5
View file @
0bac5a1b
...
...
@@ -45,7 +45,7 @@
*/
void
threadpool_log
(
struct
threadpool
*
tp
,
int
tid
,
size_t
chunk_size
,
ticks
tic
,
ticks
toc
)
{
struct
mapper_log
*
log
=
&
tp
->
logs
[
tid
];
struct
mapper_log
*
log
=
&
tp
->
logs
[
tid
>
0
?
tid
:
0
];
/* Check if we need to re-allocate the log buffer. */
if
(
log
->
count
==
log
->
size
)
{
...
...
@@ -266,14 +266,15 @@ void threadpool_map(struct threadpool *tp, threadpool_map_function map_function,
void
*
map_data
,
size_t
N
,
int
stride
,
int
chunk
,
void
*
extra_data
)
{
/* If we just have a single thread, call the map function directly. */
if
(
tp
->
num_threads
==
1
)
{
#ifdef SWIFT_DEBUG_THREADPOOL
ticks
tic
=
getticks
();
ticks
tic
=
getticks
();
#endif
/* If we just have a single thread, call the map function directly. */
if
(
tp
->
num_threads
==
1
)
{
map_function
(
map_data
,
N
,
extra_data
);
#ifdef SWIFT_DEBUG_THREADPOOL
threadpool_log
(
tp
,
0
,
N
,
tic
,
getticks
());
threadpool_log
(
tp
,
0
,
N
,
tic
,
getticks
());
#endif
return
;
}
...
...
@@ -303,6 +304,11 @@ void threadpool_map(struct threadpool *tp, threadpool_map_function map_function,
pthread_cond_wait
(
&
tp
->
control_cond
,
&
tp
->
thread_mutex
);
}
pthread_mutex_unlock
(
&
tp
->
thread_mutex
);
#ifdef SWIFT_DEBUG_THREADPOOL
/* Log the total call time to thread id -1. */
threadpool_log
(
tp
,
-
1
,
N
,
tic
,
getticks
());
#endif
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment