summaryrefslogtreecommitdiffstats
path: root/testsuites/samples/nsecs
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-06-21 22:44:21 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-06-21 22:44:21 +0000
commitd3b057906a7cd00f5112b6c9fcac36fa0bb71284 (patch)
treeb8d656d52c2ae0dc7977626eee44d8306e3614fe /testsuites/samples/nsecs
parent2007-06-21 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-d3b057906a7cd00f5112b6c9fcac36fa0bb71284.tar.bz2
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.
Diffstat (limited to 'testsuites/samples/nsecs')
-rw-r--r--testsuites/samples/nsecs/init.c24
-rw-r--r--testsuites/samples/nsecs/nsecs.scn12
2 files changed, 36 insertions, 0 deletions
diff --git a/testsuites/samples/nsecs/init.c b/testsuites/samples/nsecs/init.c
index 00f8b48f59..5a7c6e35ee 100644
--- a/testsuites/samples/nsecs/init.c
+++ b/testsuites/samples/nsecs/init.c
@@ -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);
}
diff --git a/testsuites/samples/nsecs/nsecs.scn b/testsuites/samples/nsecs/nsecs.scn
index 323cea9300..22cf9e45a4 100644
--- a/testsuites/samples/nsecs/nsecs.scn
+++ b/testsuites/samples/nsecs/nsecs.scn
@@ -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 ***