-
Notifications
You must be signed in to change notification settings - Fork 45
/
Jiffies Test
50 lines (43 loc) · 1.69 KB
/
Jiffies Test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/jiffies.h>
#include <linux/timer.h>
unsigned long js, je, tet;
int jiffies_test_init_module(void){
js = jiffies;
printk("\n[Jiffies start Time : %lu]\nModule Started.\n", js);
return 0;
}
void jiffies_test_cleanup_module(void) {
je = jiffies;
printk("\n[Jiffies End Time : %lu]\nModule Removed.\n", je);
tet = je - js;
printk("\nEnd Time [%lu] - Start Time [%lu]: \nTotlal elapsed Time [%lu]\n",js,je, tet);
}
module_init(netblock_init_module);
module_exit(netblock_cleanup_module);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("JIFFIES EXAMPLE");
MODULE_AUTHOR("shigh1005@gmail.com");
/**************************************************************
From include/linux/jiffies.h
...
/*
* Convert various time units to each other:
*/
extern unsigned int jiffies_to_msecs(const unsigned long j);
extern unsigned int jiffies_to_usecs(const unsigned long j);
extern unsigned long msecs_to_jiffies(const unsigned int m);
extern unsigned long usecs_to_jiffies(const unsigned int u);
extern unsigned long timespec_to_jiffies(const struct timespec *value);
extern void jiffies_to_timespec(const unsigned long jiffies, struct timespec *value);
extern unsigned long timeval_to_jiffies(const struct timeval *value);
extern void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value);
extern clock_t jiffies_to_clock_t(unsigned long x);
extern unsigned long clock_t_to_jiffies(unsigned long x);
extern u64 jiffies_64_to_clock_t(u64 x);
extern u64 nsec_to_clock_t(u64 x);
extern u64 nsecs_to_jiffies64(u64 n);
extern unsigned long nsecs_to_jiffies(u64 n);
...
*************************************************************/