diff options
author | Benny Prijono <bennylp@teluu.com> | 2005-11-21 16:59:47 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2005-11-21 16:59:47 +0000 |
commit | 483dfa9a40e1818c9fd1cc1dd82884ddbf243778 (patch) | |
tree | abc1e115673177003f0ad0d51ba495e4d9f05238 /pjlib/src/pjlib-test/sleep.c | |
parent | 4a4fe6471b8a930ec49a28cced2f7a5ea55aee26 (diff) |
Added rdtsc option for win32 timestamp and added pj_elapsed_msec
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@70 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pjlib-test/sleep.c')
-rw-r--r-- | pjlib/src/pjlib-test/sleep.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/pjlib/src/pjlib-test/sleep.c b/pjlib/src/pjlib-test/sleep.c index 5732a165..2c735a33 100644 --- a/pjlib/src/pjlib-test/sleep.c +++ b/pjlib/src/pjlib-test/sleep.c @@ -124,9 +124,10 @@ static int sleep_duration_test(void) { pj_time_val t1, t2; pj_timestamp start, stop; - pj_time_val elapsed; pj_uint32_t msec; + pj_thread_sleep(0); + /* Mark start of test. */ rc = pj_get_timestamp(&start); if (rc != PJ_SUCCESS) { @@ -156,10 +157,8 @@ static int sleep_duration_test(void) return -75; } - /* Get elapsed time in time_val */ - elapsed = pj_elapsed_time(&start, &stop); - - msec = PJ_TIME_VAL_MSEC(elapsed); + /* Get elapsed time in msec */ + msec = pj_elapsed_msec(&start, &stop); /* Check if it's within range. */ if (msec < DURATION2 * (100-MIS)/100 || @@ -169,7 +168,13 @@ static int sleep_duration_test(void) "...error: slept for %d ms instead of %d ms " "(outside %d%% err window)", msec, DURATION2, MIS)); - return -30; + PJ_TIME_VAL_SUB(t2, t1); + PJ_LOG(3,(THIS_FILE, + "...info: gettimeofday() reported duration is " + "%d msec", + PJ_TIME_VAL_MSEC(t2))); + + return -76; } } |