add test
[lttv.git] / tests / kernel / test-irqloop.c
CommitLineData
a4cc6451 1/* test-irqloop
2 *
3 * Test time spent for irq disabling
4 */
5
6
7#include <linux/config.h>
8#include <linux/jiffies.h>
9#include <linux/compiler.h>
10#include <linux/init.h>
11#include <linux/module.h>
12
13#define NR_LOOPS 20000
14
15static int ltt_test_init(void)
16{
17 unsigned int i;
18 cycles_t time1, time2, time;
19 cycles_t max_time = 0, min_time = 18446744073709551615ULL; /* (2^64)-1 */
20 cycles_t tot_time = 0;
21 unsigned long flags;
22 printk(KERN_ALERT "test init\n");
23
24 time1 = get_cycles();
25 for(i=0; i<NR_LOOPS; i++) {
26 local_irq_save(flags);
27 local_irq_restore(flags);
28 }
29 time2 = get_cycles();
30 time = time2 - time1;
31 tot_time += time;
32
33 printk(KERN_ALERT "test results : time for irq save/restore\n");
34 printk(KERN_ALERT "number of loops : %d\n", NR_LOOPS);
35 printk(KERN_ALERT "total time : %llu\n", tot_time);
36 //printk(KERN_ALERT "min : %llu\n", min_time);
37 //printk(KERN_ALERT "max : %llu\n", max_time);
38
39 printk(KERN_ALERT "test end\n");
40
41 return -EAGAIN; /* Fail will directly unload the module */
42}
43
44static void ltt_test_exit(void)
45{
46 printk(KERN_ALERT "test exit\n");
47}
48
49module_init(ltt_test_init)
50module_exit(ltt_test_exit)
51
52MODULE_LICENSE("GPL");
53MODULE_AUTHOR("Mathieu Desnoyers");
54MODULE_DESCRIPTION("Linux Trace Toolkit Test");
55
This page took 0.023867 seconds and 4 git commands to generate.