Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
cb6589da
Commit
cb6589da
authored
11 years ago
by
Danny Auble
Browse files
Options
Downloads
Patches
Plain Diff
Handle timers differently to give us the delta_t without having to call
and extra function
parent
56781f49
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/common/timers.c
+6
-21
6 additions, 21 deletions
src/common/timers.c
src/common/timers.h
+7
-14
7 additions, 14 deletions
src/common/timers.h
src/slurmctld/job_scheduler.c
+6
-7
6 additions, 7 deletions
src/slurmctld/job_scheduler.c
with
19 additions
and
42 deletions
src/common/timers.c
+
6
−
21
View file @
cb6589da
...
@@ -49,21 +49,20 @@
...
@@ -49,21 +49,20 @@
* IN len_tv_str - size of tv_str in bytes
* IN len_tv_str - size of tv_str in bytes
* IN from - where the function was called form
* IN from - where the function was called form
*/
*/
extern
void
slurm_diff_tv_str
(
struct
timeval
*
tv1
,
struct
timeval
*
tv2
,
extern
void
slurm_diff_tv_str
(
struct
timeval
*
tv1
,
struct
timeval
*
tv2
,
char
*
tv_str
,
int
len_tv_str
,
char
*
from
,
char
*
tv_str
,
int
len_tv_str
,
char
*
from
,
long
limit
)
long
limit
,
long
*
delta_t
)
{
{
char
p
[
64
]
=
""
;
char
p
[
64
]
=
""
;
struct
tm
tm
;
struct
tm
tm
;
long
delta_t
;
delta_t
=
(
tv2
->
tv_sec
-
tv1
->
tv_sec
)
*
1000000
;
(
*
delta_t
)
=
(
tv2
->
tv_sec
-
tv1
->
tv_sec
)
*
1000000
;
delta_t
+=
tv2
->
tv_usec
-
tv1
->
tv_usec
;
(
*
delta_t
)
+=
tv2
->
tv_usec
-
tv1
->
tv_usec
;
snprintf
(
tv_str
,
len_tv_str
,
"usec=%ld"
,
*
delta_t
);
if
(
from
)
{
if
(
from
)
{
if
(
!
limit
)
if
(
!
limit
)
limit
=
1000000
;
limit
=
1000000
;
if
(
delta_t
>
limit
)
{
if
(
*
delta_t
>
limit
)
{
snprintf
(
tv_str
,
len_tv_str
,
"usec=%ld"
,
delta_t
);
if
(
!
localtime_r
(
&
tv2
->
tv_sec
,
&
tm
))
if
(
!
localtime_r
(
&
tv2
->
tv_sec
,
&
tm
))
fprintf
(
stderr
,
"localtime_r() failed
\n
"
);
fprintf
(
stderr
,
"localtime_r() failed
\n
"
);
if
(
strftime
(
p
,
sizeof
(
p
),
"%T"
,
&
tm
)
==
0
)
if
(
strftime
(
p
,
sizeof
(
p
),
"%T"
,
&
tm
)
==
0
)
...
@@ -74,17 +73,3 @@ extern void slurm_diff_tv_str(struct timeval *tv1,struct timeval *tv2,
...
@@ -74,17 +73,3 @@ extern void slurm_diff_tv_str(struct timeval *tv1,struct timeval *tv2,
}
}
}
}
}
}
/*
* slurm_diff_tv - return the difference between two times
* IN tv1 - start of event
* IN tv2 - end of event
* RET time in micro-seconds
*/
extern
long
slurm_diff_tv
(
struct
timeval
*
tv1
,
struct
timeval
*
tv2
)
{
long
delta_t
;
delta_t
=
(
tv2
->
tv_sec
-
tv1
->
tv_sec
)
*
1000000
;
delta_t
+=
tv2
->
tv_usec
-
tv1
->
tv_usec
;
return
delta_t
;
}
This diff is collapsed.
Click to expand it.
src/common/timers.h
+
7
−
14
View file @
cb6589da
...
@@ -41,15 +41,15 @@
...
@@ -41,15 +41,15 @@
#include
<sys/time.h>
#include
<sys/time.h>
#define DEF_TIMERS struct timeval tv1, tv2; char tv_str[20] = ""
#define DEF_TIMERS struct timeval tv1, tv2; char tv_str[20] = ""
; long delta_t;
#define START_TIMER gettimeofday(&tv1, NULL)
#define START_TIMER gettimeofday(&tv1, NULL)
#define END_TIMER gettimeofday(&tv2, NULL); \
#define END_TIMER gettimeofday(&tv2, NULL); \
slurm_diff_tv_str(&tv1, &tv2, tv_str, 20, NULL, 0)
slurm_diff_tv_str(&tv1, &tv2, tv_str, 20, NULL, 0
, &delta_t
)
#define END_TIMER2(from) gettimeofday(&tv2, NULL); \
#define END_TIMER2(from) gettimeofday(&tv2, NULL); \
slurm_diff_tv_str(&tv1, &tv2, tv_str, 20, from, 0)
slurm_diff_tv_str(&tv1, &tv2, tv_str, 20, from, 0
, &delta_t
)
#define END_TIMER3(from, limit) gettimeofday(&tv2, NULL); \
#define END_TIMER3(from, limit) gettimeofday(&tv2, NULL); \
slurm_diff_tv_str(&tv1, &tv2, tv_str, 20, from, limit)
slurm_diff_tv_str(&tv1, &tv2, tv_str, 20, from, limit
, &delta_t
)
#define DELTA_TIMER
slurm_diff_tv(&tv1, &tv2)
#define DELTA_TIMER
delta_t
#define TIME_STR tv_str
#define TIME_STR tv_str
/*
/*
...
@@ -61,17 +61,10 @@
...
@@ -61,17 +61,10 @@
* IN len_tv_str - size of tv_str in bytes
* IN len_tv_str - size of tv_str in bytes
* IN from - Name to be printed on long diffs
* IN from - Name to be printed on long diffs
* IN limit - limit to wait
* IN limit - limit to wait
* OUT delta_t - raw time difference in usec
*/
*/
extern
void
slurm_diff_tv_str
(
struct
timeval
*
tv1
,
struct
timeval
*
tv2
,
extern
void
slurm_diff_tv_str
(
struct
timeval
*
tv1
,
struct
timeval
*
tv2
,
char
*
tv_str
,
int
len_tv_str
,
char
*
from
,
char
*
tv_str
,
int
len_tv_str
,
char
*
from
,
long
limit
);
long
limit
,
long
*
delta_t
);
/*
* slurm_diff_tv - return the difference between two times
* IN tv1 - start of event
* IN tv2 - end of event
* RET time in micro-seconds
*/
extern
long
slurm_diff_tv
(
struct
timeval
*
tv1
,
struct
timeval
*
tv2
);
#endif
#endif
This diff is collapsed.
Click to expand it.
src/slurmctld/job_scheduler.c
+
6
−
7
View file @
cb6589da
...
@@ -401,14 +401,13 @@ static bool _failed_partition(struct part_record *part_ptr,
...
@@ -401,14 +401,13 @@ static bool _failed_partition(struct part_record *part_ptr,
return
false
;
return
false
;
}
}
static
void
do_diag_stats
(
struct
timeval
tv1
,
struct
timeval
tv2
)
static
void
_
do_diag_stats
(
long
delta_t
)
{
{
if
(
slurm_diff_tv
(
&
tv1
,
&
tv2
)
>
slurmctld_diag_stats
.
schedule_cycle_max
)
if
(
delta_t
>
slurmctld_diag_stats
.
schedule_cycle_max
)
slurmctld_diag_stats
.
schedule_cycle_max
=
slurm_diff_tv
(
&
tv1
,
slurmctld_diag_stats
.
schedule_cycle_max
=
delta_t
;
&
tv2
);
slurmctld_diag_stats
.
schedule_cycle_sum
+=
slurm_diff_tv
(
&
tv1
,
&
tv2
)
;
slurmctld_diag_stats
.
schedule_cycle_sum
+=
delta_t
;
slurmctld_diag_stats
.
schedule_cycle_last
=
slurm_diff_tv
(
&
tv1
,
&
tv2
)
;
slurmctld_diag_stats
.
schedule_cycle_last
=
delta_t
;
slurmctld_diag_stats
.
schedule_cycle_counter
++
;
slurmctld_diag_stats
.
schedule_cycle_counter
++
;
}
}
...
@@ -1080,7 +1079,7 @@ next_part: part_ptr = (struct part_record *)
...
@@ -1080,7 +1079,7 @@ next_part: part_ptr = (struct part_record *)
unlock_slurmctld
(
job_write_lock
);
unlock_slurmctld
(
job_write_lock
);
END_TIMER2
(
"schedule"
);
END_TIMER2
(
"schedule"
);
do_diag_stats
(
tv1
,
tv2
);
_
do_diag_stats
(
DELTA_TIMER
);
return
job_cnt
;
return
job_cnt
;
}
}
...
...
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