2007-06-21 Joel Sherrill <joel.sherrill@oarcorp.com>

* nsecs/init.c, nsecs/nsecs.scn: Add set of loops so you can see the
	time varaying in proportion to the length of the loop measured.
This commit is contained in:
Joel Sherrill
2007-06-21 22:44:21 +00:00
parent 58a7d5f92c
commit d3b057906a
3 changed files with 41 additions and 0 deletions

View File

@@ -1,3 +1,8 @@
2007-06-21 Joel Sherrill <joel.sherrill@oarcorp.com>
* nsecs/init.c, nsecs/nsecs.scn: Add set of loops so you can see the
time varaying in proportion to the length of the loop measured.
2007-05-16 Ralf Corsepius <ralf.corsepius@rtems.org>
* nsecs/init.c: Remove stray "volatile int i".

View File

@@ -103,6 +103,30 @@ rtems_task Init(
);
}
/*
* Iterate 10 times showing difference in Uptime with different counts
*/
printf( "\n10 iterations of getting Uptime with different loop values\n" );
for (index=1 ; index <=10 ; index++ ) {
struct timespec start, stop;
struct timespec diff;
int j, max = (index * 10000);
rtems_clock_get_uptime( &start );
for (j=0 ; j<max ; j++ )
Empty_function();
rtems_clock_get_uptime( &stop );
subtract_em( &start, &stop, &diff );
printf( "loop of %d %d:%d %d:%d --> %d:%d\n",
max,
start.tv_sec, start.tv_nsec,
stop.tv_sec, stop.tv_nsec,
diff.tv_sec, diff.tv_nsec
);
}
sleep(1);
puts( "*** END OF NANOSECOND CLOCK TEST ***" );
exit(0);
}

View File

@@ -33,4 +33,16 @@ Stop : Sat Mar 24 11:15:00 2007:32835000 --> 0:9000
0:48282000 0:48291000 --> 0:9000
0:49595000 0:49603000 --> 0:8000
0:50908000 0:50917000 --> 0:9000
10 iterations of getting Uptime with different loop values
loop of 10000 0:119488000 0:119704000 --> 0:216000
loop of 20000 0:124028000 0:124463000 --> 0:435000
loop of 30000 0:128567000 0:129220000 --> 0:653000
loop of 40000 0:133097000 0:133964000 --> 0:867000
loop of 50000 0:137643000 0:138728000 --> 0:1085000
loop of 60000 0:142265000 0:143572000 --> 0:1307000
loop of 70000 0:146894000 0:148416000 --> 0:1522000
loop of 80000 0:151519000 0:153260000 --> 0:1741000
loop of 90000 0:156145000 0:158099000 --> 0:1954000
loop of 100000 0:160770000 0:162942000 --> 0:2172000
*** END OF NANOSECOND CLOCK TEST ***