Commit fba1579f authored by Pekka Pessi's avatar Pekka Pessi
Browse files

torture_su_timer.c: updated output from timer stress test.

darcs-hash:20070704204007-65a35-6fcde03ae485c30d6adc02ecca563b9bfca0d48b.gz
parent 0143fc30
...@@ -147,8 +147,8 @@ int main(int argc, char *argv[]) ...@@ -147,8 +147,8 @@ int main(int argc, char *argv[])
char *argv0 = argv[0]; char *argv0 = argv[0];
char *s; char *s;
int use_t1 = 0; int use_t1 = 0;
su_time_t now, started; su_time_t now, started, inserted;
intptr_t i, N = 500; unsigned i, N = 500;
struct timing timing[1] = {{ 0 }}; struct timing timing[1] = {{ 0 }};
struct tester tester[1] = {{ 0 }}; struct tester tester[1] = {{ 0 }};
...@@ -240,22 +240,34 @@ int main(int argc, char *argv[]) ...@@ -240,22 +240,34 @@ int main(int argc, char *argv[])
timers = calloc(N, sizeof *timers); timers = calloc(N, sizeof *timers);
if (!timers) { perror("calloc"); exit(1); } if (!timers) { perror("calloc"); exit(1); }
now = started = su_now();
for (i = 0; i < N; i++) { for (i = 0; i < N; i++) {
t = su_timer_create(su_root_task(root), 1000); t = su_timer_create(su_root_task(root), 1000);
if (!t) { perror("su_timer_create"); exit(1); } if (!t) { perror("su_timer_create"); exit(1); }
if (++now.tv_usec == 0) ++now.tv_sec;
su_timer_set_at(t, increment, (void *)i, now);
timers[i] = t; timers[i] = t;
} }
tester->sentinel = (void*)(i - 1); now = started = su_now();
for (i = 0; i < N; i++) {
if (++now.tv_usec == 0) ++now.tv_sec;
su_timer_set_at(timers[i], increment, (void *)(intptr_t)i, now);
}
tester->sentinel = (void*)(intptr_t)(i - 1);
inserted = su_now();
su_root_run(root); su_root_run(root);
printf("Processing %u timers took %f millisec (%f expected)\n", now = su_now();
(unsigned)i, su_time_diff(su_now(), started) * 1000, (double)i / 1000);
printf("Inserting %u timers took %f millisec\n",
i, su_time_diff(inserted, started) * 1000);
printf("Processing %u/%u timers took %f millisec (%f expected)\n",
tester->times, i,
su_time_diff(now, started) * 1000,
(double)i / 1000);
for (i = 0; i < N; i++) { for (i = 0; i < N; i++) {
su_timer_destroy(timers[i]); su_timer_destroy(timers[i]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment