Date: Thu, 3 Jan 2008 23:33:29 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 132440 for review Message-ID: <200801032333.m03NXT0N073511@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=132440 Change 132440 by jb@jb_freebsd1 on 2008/01/03 23:33:11 Add a simple test for the cyclic_add_omni() call to fire timers on all CPUs. Affected files ... .. //depot/projects/dtrace/src/sys/cddl/kern/cyclic_test.c#3 edit Differences ... ==== //depot/projects/dtrace/src/sys/cddl/kern/cyclic_test.c#3 (text+ko) ==== @@ -45,7 +45,7 @@ nanotime(&ts); timespecsub(&ts,&test_001_start); - printf("%s: called after %lu.%09lu\n",__func__,(u_long) ts.tv_sec,(u_long) ts.tv_nsec); + printf("%s: called after %lu.%09lu on curcpu %d\n",__func__,(u_long) ts.tv_sec,(u_long) ts.tv_nsec, curcpu); } static void @@ -60,7 +60,6 @@ hdlr.cyh_func = (cyc_func_t) cyclic_test_001_func; hdlr.cyh_arg = 0; - hdlr.cyh_level = CY_LOW_LEVEL; when.cyt_when = 0; when.cyt_interval = 1000000000; @@ -84,13 +83,63 @@ printf("%s: %s\n",__func__, error == 0 ? "passed":"failed"); } +static struct timespec test_002_start; + +static void +cyclic_test_002_func(void *arg) +{ + struct timespec ts; + + nanotime(&ts); + timespecsub(&ts,&test_002_start); + printf("%s: called after %lu.%09lu on curcpu %d\n",__func__,(u_long) ts.tv_sec,(u_long) ts.tv_nsec, curcpu); +} + +static void +cyclic_test_002_online(void *arg, cpu_t *c, cyc_handler_t *hdlr, cyc_time_t *t) +{ + printf("%s: online on curcpu %d\n",__func__, curcpu); + hdlr->cyh_func = cyclic_test_002_func; + hdlr->cyh_arg = NULL; + t->cyt_when = 0; + t->cyt_interval = 1000000000; +} + +static void +cyclic_test_002_offline(void *arg, cpu_t *c, void *arg1) +{ + printf("%s: offline on curcpu %d\n",__func__, curcpu); +} + static void cyclic_test_002(void) { int error = 0; + cyc_omni_handler_t hdlr; + cyclic_id_t id; printf("%s: starting\n",__func__); - DELAY(60000000); + + hdlr.cyo_online = cyclic_test_002_online; + hdlr.cyo_offline = cyclic_test_002_offline; + hdlr.cyo_arg = NULL; + + nanotime(&test_002_start); + + mutex_enter(&cpu_lock); + + id = cyclic_add_omni(&hdlr); + + mutex_exit(&cpu_lock); + + DELAY(1200000); + + mutex_enter(&cpu_lock); + + cyclic_remove(id); + + mutex_exit(&cpu_lock); + printf("%s: %s\n",__func__, error == 0 ? "passed":"failed"); } @@ -180,3 +229,4 @@ DEV_MODULE(cyclic_test, cyclic_test_modevent, NULL); MODULE_VERSION(cyclic_test, 1); MODULE_DEPEND(cyclic_test, cyclic, 1, 1, 1); +MODULE_DEPEND(cyclic_test, opensolaris, 1, 1, 1);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801032333.m03NXT0N073511>