File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,12 @@ enum Commands {
67
67
}
68
68
69
69
fn main ( ) {
70
+ // Obtain the time stamp early so that it more properly reflects the time the sample was
71
+ // obtained, not the time when reporting was allowed to run. The latter is subject to greater
72
+ // system effects, and using that timestamp increases the risk that the samples' timestamp order
73
+ // improperly reflects the true order in which they were obtained. See #100.
74
+ let timestamp = util:: time_iso8601 ( ) ;
75
+
70
76
env_logger:: init ( ) ;
71
77
72
78
let cli = Cli :: parse ( ) ;
@@ -102,10 +108,10 @@ fn main() {
102
108
} ;
103
109
if * batchless {
104
110
let mut jm = batchless:: BatchlessJobManager :: new ( ) ;
105
- ps:: create_snapshot ( & mut jm, & opts) ;
111
+ ps:: create_snapshot ( & mut jm, & opts, & timestamp ) ;
106
112
} else {
107
113
let mut jm = slurm:: SlurmJobManager { } ;
108
- ps:: create_snapshot ( & mut jm, & opts) ;
114
+ ps:: create_snapshot ( & mut jm, & opts, & timestamp ) ;
109
115
}
110
116
}
111
117
Commands :: Analyze { } => {
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ use crate::jobs;
9
9
use crate :: nvidia;
10
10
use crate :: process;
11
11
use crate :: procfs;
12
+ use crate :: util:: three_places;
12
13
use crate :: procfsapi;
13
- use crate :: util:: { three_places, time_iso8601} ;
14
14
15
15
use csv:: { Writer , WriterBuilder } ;
16
16
use std:: collections:: { HashMap , HashSet } ;
@@ -163,7 +163,7 @@ pub struct PsOptions<'a> {
163
163
pub exclude_commands : Vec < & ' a str > ,
164
164
}
165
165
166
- pub fn create_snapshot ( jobs : & mut dyn jobs:: JobManager , opts : & PsOptions ) {
166
+ pub fn create_snapshot ( jobs : & mut dyn jobs:: JobManager , opts : & PsOptions , timestamp : & str ) {
167
167
let no_gpus = empty_gpuset ( ) ;
168
168
let mut proc_by_pid = ProcTable :: new ( ) ;
169
169
@@ -313,13 +313,12 @@ pub fn create_snapshot(jobs: &mut dyn jobs::JobManager, opts: &PsOptions) {
313
313
. flexible ( true )
314
314
. from_writer ( io:: stdout ( ) ) ;
315
315
316
- let timestamp = time_iso8601 ( ) ;
317
316
let hostname = hostname:: get ( ) . unwrap ( ) . into_string ( ) . unwrap ( ) ;
318
317
let num_cores = num_cpus:: get ( ) ;
319
318
const VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
320
319
let print_params = PrintParameters {
321
320
hostname : & hostname,
322
- timestamp : & timestamp,
321
+ timestamp : timestamp,
323
322
num_cores,
324
323
version : VERSION ,
325
324
opts,
You can’t perform that action at this time.
0 commit comments