@@ -39,6 +39,7 @@ extern int* retry2[];
39
39
extern int * failure2 [];
40
40
41
41
extern double max_rt [];
42
+ extern double total_rt [];
42
43
43
44
extern long clk_tck ;
44
45
@@ -131,10 +132,10 @@ static int do_neword (int t_num)
131
132
qty [i ] = RandomNumber (1 , 10 );
132
133
}
133
134
134
- clk1 = clock_gettime (CLOCK_THREAD_CPUTIME_ID , & tbuf1 );
135
+ clk1 = clock_gettime (CLOCK_MONOTONIC , & tbuf1 );
135
136
for (i = 0 ; i < MAX_RETRY ; i ++ ) {
136
137
ret = neword (t_num , w_id , d_id , c_id , ol_cnt , all_local , itemid , supware , qty );
137
- clk2 = clock_gettime (CLOCK_THREAD_CPUTIME_ID , & tbuf2 );
138
+ clk2 = clock_gettime (CLOCK_MONOTONIC , & tbuf2 );
138
139
139
140
if (ret ){
140
141
@@ -146,6 +147,7 @@ static int do_neword (int t_num)
146
147
147
148
if (rt > max_rt [0 ])
148
149
max_rt [0 ]= rt ;
150
+ total_rt [0 ] += rt ;
149
151
hist_inc (0 , rt );
150
152
if (counting_on ){
151
153
if ( rt < RTIME_NEWORD ){
@@ -229,16 +231,17 @@ static int do_payment (int t_num)
229
231
c_d_id = RandomNumber (1 , DIST_PER_WARE );
230
232
}
231
233
232
- clk1 = clock_gettime (CLOCK_THREAD_CPUTIME_ID , & tbuf1 );
234
+ clk1 = clock_gettime (CLOCK_MONOTONIC , & tbuf1 );
233
235
for (i = 0 ; i < MAX_RETRY ; i ++ ) {
234
236
ret = payment (t_num , w_id , d_id , byname , c_w_id , c_d_id , c_id , c_last , h_amount );
235
- clk2 = clock_gettime (CLOCK_THREAD_CPUTIME_ID , & tbuf2 );
237
+ clk2 = clock_gettime (CLOCK_MONOTONIC , & tbuf2 );
236
238
237
239
if (ret ){
238
240
239
241
rt = (double )(tbuf2 .tv_sec * 1000.0 + tbuf2 .tv_nsec /1000000.0 - tbuf1 .tv_sec * 1000.0 - tbuf1 .tv_nsec /1000000.0 );
240
242
if (rt > max_rt [1 ])
241
243
max_rt [1 ]= rt ;
244
+ total_rt [1 ] += rt ;
242
245
hist_inc (1 , rt );
243
246
if (counting_on ){
244
247
if ( rt < RTIME_PAYMENT ){
@@ -301,16 +304,17 @@ static int do_ordstat (int t_num)
301
304
byname = 0 ; /* select by customer id */
302
305
}
303
306
304
- clk1 = clock_gettime (CLOCK_THREAD_CPUTIME_ID , & tbuf1 );
307
+ clk1 = clock_gettime (CLOCK_MONOTONIC , & tbuf1 );
305
308
for (i = 0 ; i < MAX_RETRY ; i ++ ) {
306
309
ret = ordstat (t_num , w_id , d_id , byname , c_id , c_last );
307
- clk2 = clock_gettime (CLOCK_THREAD_CPUTIME_ID , & tbuf2 );
310
+ clk2 = clock_gettime (CLOCK_MONOTONIC , & tbuf2 );
308
311
309
312
if (ret ){
310
313
311
314
rt = (double )(tbuf2 .tv_sec * 1000.0 + tbuf2 .tv_nsec /1000000.0 - tbuf1 .tv_sec * 1000.0 - tbuf1 .tv_nsec /1000000.0 );
312
315
if (rt > max_rt [2 ])
313
316
max_rt [2 ]= rt ;
317
+ total_rt [2 ] += rt ;
314
318
hist_inc (2 , rt );
315
319
if (counting_on ){
316
320
if ( rt < RTIME_ORDSTAT ){
@@ -366,16 +370,17 @@ static int do_delivery (int t_num)
366
370
}
367
371
o_carrier_id = RandomNumber (1 , 10 );
368
372
369
- clk1 = clock_gettime (CLOCK_THREAD_CPUTIME_ID , & tbuf1 );
373
+ clk1 = clock_gettime (CLOCK_MONOTONIC , & tbuf1 );
370
374
for (i = 0 ; i < MAX_RETRY ; i ++ ) {
371
375
ret = delivery (t_num , w_id , o_carrier_id );
372
- clk2 = clock_gettime (CLOCK_THREAD_CPUTIME_ID , & tbuf2 );
376
+ clk2 = clock_gettime (CLOCK_MONOTONIC , & tbuf2 );
373
377
374
378
if (ret ){
375
379
376
380
rt = (double )(tbuf2 .tv_sec * 1000.0 + tbuf2 .tv_nsec /1000000.0 - tbuf1 .tv_sec * 1000.0 - tbuf1 .tv_nsec /1000000.0 );
377
381
if (rt > max_rt [3 ])
378
382
max_rt [3 ]= rt ;
383
+ total_rt [3 ] += rt ;
379
384
hist_inc (3 , rt );
380
385
if (counting_on ){
381
386
if ( rt < RTIME_DELIVERY ){
@@ -432,16 +437,17 @@ static int do_slev (int t_num)
432
437
d_id = RandomNumber (1 , DIST_PER_WARE );
433
438
level = RandomNumber (10 , 20 );
434
439
435
- clk1 = clock_gettime (CLOCK_THREAD_CPUTIME_ID , & tbuf1 );
440
+ clk1 = clock_gettime (CLOCK_MONOTONIC , & tbuf1 );
436
441
for (i = 0 ; i < MAX_RETRY ; i ++ ) {
437
442
ret = slev (t_num , w_id , d_id , level );
438
- clk2 = clock_gettime (CLOCK_THREAD_CPUTIME_ID , & tbuf2 );
443
+ clk2 = clock_gettime (CLOCK_MONOTONIC , & tbuf2 );
439
444
440
445
if (ret ){
441
446
442
447
rt = (double )(tbuf2 .tv_sec * 1000.0 + tbuf2 .tv_nsec /1000000.0 - tbuf1 .tv_sec * 1000.0 - tbuf1 .tv_nsec /1000000.0 );
443
448
if (rt > max_rt [4 ])
444
449
max_rt [4 ]= rt ;
450
+ total_rt [4 ] += rt ;
445
451
hist_inc (4 , rt );
446
452
if (counting_on ){
447
453
if ( rt < RTIME_SLEV ){
0 commit comments