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
770114c8
Commit
770114c8
authored
11 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
add global timers for cell lock/unlock.
Former-commit-id: 946b62b78997ce0649f28d20afac5fd52d59137b
parent
f36bddec
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cell.c
+6
-29
6 additions, 29 deletions
src/cell.c
src/cell.h
+0
-9
0 additions, 9 deletions
src/cell.h
src/timers.h
+1
-1
1 addition, 1 deletion
src/timers.h
with
7 additions
and
39 deletions
src/cell.c
+
6
−
29
View file @
770114c8
...
...
@@ -33,35 +33,12 @@
#include
"cycle.h"
#include
"lock.h"
#include
"task.h"
#include
"timers.h"
#include
"part.h"
#include
"cell.h"
#include
"error.h"
#include
"inline.h"
/* The timers. */
ticks
cell_timer
[
cell_timer_count
];
/* Define the timer macros. */
#ifdef TIMER_VERBOSE
#ifndef TIMER
#define TIMER
#endif
#endif
#ifdef TIMER
#define TIMER_TIC ticks tic = getticks();
#define TIMER_TOC(t) timer_toc( t , tic )
#define TIMER_TIC2 ticks tic2 = getticks();
#define TIMER_TOC2(t) timer_toc( t , tic2 )
INLINE
static
ticks
timer_toc
(
int
t
,
ticks
tic
)
{
ticks
d
=
(
getticks
()
-
tic
);
__sync_add_and_fetch
(
&
cell_timer
[
t
]
,
d
);
return
d
;
}
#else
#define TIMER_TIC
#define TIMER_TOC(t)
#endif
/**
* @brief Lock a cell and hold its parents.
...
...
@@ -76,7 +53,7 @@ int cell_locktree( struct cell *c ) {
/* First of all, try to lock this cell. */
if
(
c
->
hold
||
lock_trylock
(
&
c
->
lock
)
!=
0
)
{
TIMER_TOC
(
cell_
timer_tree
);
TIMER_TOC
(
timer_
lock
tree
);
return
1
;
}
...
...
@@ -88,7 +65,7 @@ int cell_locktree( struct cell *c ) {
error
(
"Failed to unlock cell."
);
/* Admit defeat. */
TIMER_TOC
(
cell_
timer_tree
);
TIMER_TOC
(
timer_
lock
tree
);
return
1
;
}
...
...
@@ -111,7 +88,7 @@ int cell_locktree( struct cell *c ) {
/* If we reached the top of the tree, we're done. */
if
(
finger
==
NULL
)
{
TIMER_TOC
(
cell_
timer_tree
);
TIMER_TOC
(
timer_
lock
tree
);
return
0
;
}
...
...
@@ -127,7 +104,7 @@ int cell_locktree( struct cell *c ) {
error
(
"Failed to unlock cell."
);
/* Admit defeat. */
TIMER_TOC
(
cell_
timer_tree
);
TIMER_TOC
(
timer_
lock
tree
);
return
1
;
}
...
...
@@ -154,7 +131,7 @@ void cell_unlocktree( struct cell *c ) {
for
(
finger
=
c
->
parent
;
finger
!=
NULL
;
finger
=
finger
->
parent
)
__sync_fetch_and_sub
(
&
finger
->
hold
,
1
);
TIMER_TOC
(
cell_
timer_tree
);
TIMER_TOC
(
timer_
lock
tree
);
}
...
...
This diff is collapsed.
Click to expand it.
src/cell.h
+
0
−
9
View file @
770114c8
...
...
@@ -21,15 +21,6 @@
#define cell_sid_dt 13
/* The queue timers. */
enum
{
cell_timer_none
=
0
,
cell_timer_tree
,
cell_timer_count
,
};
extern
ticks
cell_timer
[
cell_timer_count
];
/* Structure to store the data of a single cell. */
struct
cell
{
...
...
This diff is collapsed.
Click to expand it.
src/timers.h
+
1
−
1
View file @
770114c8
...
...
@@ -36,7 +36,7 @@ enum {
timer_doghost
,
timer_gettask
,
timer_qlock
,
timer_
stalled
,
timer_
locktree
,
timer_runners
,
timer_step
,
timer_count
,
...
...
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