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
4d27c8ba
Commit
4d27c8ba
authored
8 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
clear the task wait/tic/toc only when needed, not explicitly in scheduler_start.
parent
1183a0a6
No related branches found
No related tags found
1 merge request
!282
Scheduler activate root
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/scheduler.c
+10
-13
10 additions, 13 deletions
src/scheduler.c
src/scheduler.h
+1
-0
1 addition, 0 deletions
src/scheduler.h
with
11 additions
and
13 deletions
src/scheduler.c
+
10
−
13
View file @
4d27c8ba
...
...
@@ -1034,8 +1034,15 @@ void scheduler_rewait_active_mapper(void *map_data, int num_elements,
for
(
int
ind
=
0
;
ind
<
num_elements
;
ind
++
)
{
struct
task
*
t
=
&
s
->
tasks
[
tid
[
ind
]];
if
(
t
->
skip
||
!
((
1
<<
t
->
type
)
&
mask
)
||
!
((
1
<<
t
->
subtype
)
&
submask
))
/* Ignore masked-out tasks. */
if
(
t
->
skip
||
!
((
1
<<
t
->
type
)
&
mask
)
||
!
((
1
<<
t
->
subtype
)
&
submask
))
{
t
->
skip
=
1
;
continue
;
}
/* Increment the task's own wait counter for the enqueueing. */
atomic_inc
(
&
t
->
wait
);
t
->
tic
=
t
->
toc
=
0
;
/* Skip sort tasks that have already been performed */
if
(
t
->
type
==
task_type_sort
&&
t
->
flags
==
0
)
{
...
...
@@ -1083,18 +1090,6 @@ void scheduler_start(struct scheduler *s, unsigned int mask,
s
->
mask
=
mask
;
s
->
submask
=
submask
|=
(
1
<<
task_subtype_none
);
/* Clear all the waits and times. */
for
(
int
k
=
0
;
k
<
s
->
active_count
;
k
++
)
{
struct
task
*
t
=
&
s
->
tasks
[
s
->
tid_active
[
k
]];
t
->
wait
=
1
;
t
->
tic
=
0
;
t
->
toc
=
0
;
if
(((
1
<<
t
->
type
)
&
mask
)
==
0
||
((
1
<<
t
->
subtype
)
&
submask
)
==
0
)
t
->
skip
=
1
;
}
/* message("clear took %.3f %s.", clocks_from_ticks(getticks() - tic),
clocks_getunit()); */
/* Re-wait the tasks. */
if
(
s
->
active_count
>
1000
)
{
threadpool_map
(
s
->
threadpool
,
scheduler_rewait_active_mapper
,
s
->
tid_active
,
...
...
@@ -1296,6 +1291,8 @@ struct task *scheduler_done(struct scheduler *s, struct task *t) {
they are ready. */
for
(
int
k
=
0
;
k
<
t
->
nr_unlock_tasks
;
k
++
)
{
struct
task
*
t2
=
t
->
unlock_tasks
[
k
];
if
(
t2
->
skip
||
!
((
1
<<
t2
->
type
)
&
s
->
mask
)
||
!
((
1
<<
t2
->
subtype
)
&
s
->
submask
))
continue
;
const
int
res
=
atomic_dec
(
&
t2
->
wait
);
if
(
res
<
1
)
{
...
...
This diff is collapsed.
Click to expand it.
src/scheduler.h
+
1
−
0
View file @
4d27c8ba
...
...
@@ -121,6 +121,7 @@ struct scheduler {
__attribute__
((
always_inline
))
INLINE
static
void
scheduler_activate
(
struct
scheduler
*
s
,
struct
task
*
t
)
{
if
(
atomic_cas
(
&
t
->
skip
,
1
,
0
))
{
t
->
wait
=
0
;
int
ind
=
atomic_inc
(
&
s
->
active_count
);
s
->
tid_active
[
ind
]
=
t
-
s
->
tasks
;
}
...
...
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