Parent Directory | Revision Log
* NKSP: Implemented built-in script variable "$KSP_TIMER". * NKSP: Implemented built-in script variable "$NKSP_REAL_TIMER". * NKSP: Implemented built-in script variable "$NKSP_PERF_TIMER". * NKSP: Implemented built-in script variable "$ENGINE_UPTIME". * Bumped version (2.0.0.svn14).
1 | { |
2 | This example demonstrates how to benchmark a NKSP instrument script. |
3 | } |
4 | on init |
5 | declare $start |
6 | declare $end |
7 | declare $i |
8 | declare const $TOTAL_LOOPS := 1000 |
9 | |
10 | { measures and prints the total amount of microseconds the following loop took in reality } |
11 | $i := 0 |
12 | $start := $NKSP_REAL_TIMER |
13 | while ($i < $TOTAL_LOOPS) |
14 | $i := $i + 1 |
15 | end while |
16 | $end := $NKSP_REAL_TIMER; |
17 | message($TOTAL_LOOPS & " loops took " & ($end - $start) & " microseconds (real time)") |
18 | |
19 | { measures and prints the amount of microseconds CPU execution time the following loop took } |
20 | $i := 0 |
21 | $start := $NKSP_PERF_TIMER |
22 | while ($i < $TOTAL_LOOPS) |
23 | $i := $i + 1 |
24 | end while |
25 | $end := $NKSP_PERF_TIMER; |
26 | message($TOTAL_LOOPS & " loops took " & ($end - $start) & " microseconds (CPU time)") |
27 | |
28 | end on |
ViewVC Help | |
Powered by ViewVC |