#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef CONFIG_LOCAL_WDT extern int nr_cpu_ids; #else #define nr_cpu_ids 1 #endif //extern int nr_cpu_ids; //int enable_clock(int id, unsigned char *name); static int test_case = 0; static int ts_msleep = 0; static int msleep_times = 0; static int ts_mdelay = 0; static int mdelay_times = 0; static int ts_udelay = 0; static int udelay_times = 0; static long ts_hrtimer_sec = 0; static unsigned long ts_hrtimer_nsecs = 0; static int ts_hrtimer_times = 0; static struct hrtimer hrtimer_test; u64 hr_t1=0; u64 hr_t2=0; module_param(test_case, int, 00664); module_param(ts_msleep, int, 00664); module_param(msleep_times, int, 00664); module_param(ts_mdelay, int, 00664); module_param(mdelay_times, int, 00664); module_param(ts_udelay, int, 00664); module_param(udelay_times, int, 00664); module_param(ts_hrtimer_sec, int, 00664); module_param(ts_hrtimer_nsecs, int, 00664); module_param(ts_hrtimer_times, int, 00664); static DEFINE_SPINLOCK(wdt_test_lock0); static DEFINE_SPINLOCK(wdt_test_lock1); static struct task_struct *wk_tsk[2];// cpu: 2 static int data; static int hrtimer_test_case(); static int __cpuinit cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { int hotcpu = (unsigned long)hcpu; switch (action) { case CPU_UP_PREPARE: case CPU_UP_PREPARE_FROZEN: // watchdog_prepare_cpu(hotcpu); break; case CPU_ONLINE: case CPU_ONLINE_FROZEN: // if(hotcpu < nr_cpu_ids) { kthread_bind(wk_tsk[hotcpu], hotcpu); wake_up_process(wk_tsk[hotcpu]); printk("[WDK-test]cpu %d plug on ", hotcpu); } break; #ifdef CONFIG_HOTPLUG_CPU case CPU_UP_CANCELED: case CPU_UP_CANCELED_FROZEN: case CPU_DEAD: case CPU_DEAD_FROZEN: printk("[WDK-test]:start Stop CPU:%d\n", hotcpu); break; #endif /* CONFIG_HOTPLUG_CPU */ } /* * hardlockup and softlockup are not important enough * to block cpu bring up. Just always succeed and * rely on printk output to flag problems. */ return NOTIFY_OK; } static struct notifier_block __cpuinitdata cpu_nfb = { .notifier_call = cpu_callback }; static int msleep_test(int length, int times) { u64 t1=0; u64 t2=0; int i =0; t1 = sched_clock(); for(i=0; iread_proc = wk_proc_cmd_read; de->write_proc = wk_proc_cmd_write; return 0 ; } void TimerUT_proc_exit(void) { remove_proc_entry(PROC_WK, NULL); } #endif module_init(test_init); module_exit(test_exit);