Skip to content

Commit 9c17e00

Browse files
committed
Adjust CPU measurements to cover only the measurement part of a test run
1 parent 7e267fd commit 9c17e00

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

VERSION.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nwtest version 1.7
1+
nwtest version 1.8

source/nwtest.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Configuration things. These can be changed (with care).
2424
*/
2525
#define PROGNAME "NWTEST"
26-
#define VERSION "1.7"
26+
#define VERSION "1.8"
2727

2828
#define ALLOW_NODELAY 1
2929
#define ALLOW_BUFFSIZE 1

source/nwtest_client.c

+17-6
Original file line numberDiff line numberDiff line change
@@ -1418,10 +1418,6 @@ displayStats(
14181418
if ( ctxt == NULL )
14191419
return;
14201420

1421-
1422-
gettimeofday( &pend, NULL );
1423-
getrusage( RUSAGE_SELF, &rend );
1424-
14251421
cpu_user = rend.ru_utime.tv_sec - rstart.ru_utime.tv_sec;
14261422
cpu_ususer = rend.ru_utime.tv_usec - rstart.ru_utime.tv_usec;
14271423
if ( cpu_ususer < 0 )
@@ -1769,8 +1765,6 @@ cmdClient(
17691765
}
17701766

17711767
// Hand off connections to dedicated threads
1772-
gettimeofday( &pstart, NULL );
1773-
getrusage( RUSAGE_SELF, &rstart );
17741768
for ( connid = 0; connid < ctxt->nconn; connid++ )
17751769
{
17761770
if ( stopReceived() )
@@ -1794,6 +1788,8 @@ cmdClient(
17941788
}
17951789
else
17961790
{
1791+
gettimeofday( &pstart, NULL );
1792+
getrusage( RUSAGE_SELF, &rstart );
17971793
dlimit = now + (ctxt->dur * 1000000);
17981794
tstate = ptstate = MEASURE;
17991795
}
@@ -1803,7 +1799,14 @@ cmdClient(
18031799
{
18041800
now = getTS( 0 );
18051801
if ( stopReceived() )
1802+
{
18061803
tstate = STOP;
1804+
if ( dlimit && ! ramping )
1805+
{
1806+
getrusage( RUSAGE_SELF, &rend );
1807+
gettimeofday( &pend, NULL );
1808+
}
1809+
}
18071810
else
18081811
if ( ramping )
18091812
{
@@ -1814,6 +1817,8 @@ cmdClient(
18141817
ramping = 0;
18151818
dlimit = now + (ctxt->dur * 1000000);
18161819
tstate = MEASURE;
1820+
gettimeofday( &pstart, NULL );
1821+
getrusage( RUSAGE_SELF, &rstart );
18171822
}
18181823
else
18191824
tstate = END;
@@ -1827,9 +1832,15 @@ cmdClient(
18271832
ramping = 1;
18281833
rlimit = now + (ctxt->ramp * 1000000);
18291834
tstate = RAMP;
1835+
getrusage( RUSAGE_SELF, &rend );
1836+
gettimeofday( &pend, NULL );
18301837
}
18311838
else
1839+
{
18321840
tstate = END;
1841+
getrusage( RUSAGE_SELF, &rend );
1842+
gettimeofday( &pend, NULL );
1843+
}
18331844
}
18341845
if ( tstate != ptstate )
18351846
{

source/nwtest_help.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,11 @@ help_metrics( void )
279279
"Minimum R/T - The lowest round trip time across all connections during\n"
280280
" the measurement period (µs).\n\n"
281281

282-
"Average R/T - The average round trip time across all threads during the\n"
283-
" measurement period (µs).\n\n"
282+
"Average R/T - The average round trip time across all connections during\n"
283+
" the measurement period (µs).\n\n"
284284

285-
"Maximum R/T - The highest round trip time across all threads during the\n"
286-
" measurement period (µs).\n\n"
285+
"Maximum R/T - The highest round trip time across all connections during\n"
286+
" the measurement period (µs).\n\n"
287287

288288
"In brief mode the output consists of a single line as follows:\n\n"
289289

0 commit comments

Comments
 (0)