projects
/
lttv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update
[lttv.git]
/
tests
/
kernel
/
test-cmpxchg.c
diff --git
a/tests/kernel/test-cmpxchg.c
b/tests/kernel/test-cmpxchg.c
index a81663319c6f3af32749fd126254ab8d146383bb..58264a934999e0803df4a2379b4c398b03f6e139 100644
(file)
--- a/
tests/kernel/test-cmpxchg.c
+++ b/
tests/kernel/test-cmpxchg.c
@@
-4,24
+4,27
@@
*/
*/
+#include <linux/jiffies.h>
+#include <linux/compiler.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/module.h>
-#include <linux/ltt-core.h>
-#include <asm/system.h>
-#define NR_LOOPS 2000
+#define NR_LOOPS 2000
0
-
static
volatile int test_val = 100;
+volatile int test_val = 100;
-static void do_test(void)
+
+static inline void do_test(void)
{
{
- int val;
+ int val
, ret
;
val = test_val;
val = test_val;
- ret = cmpxchg(&test_val, val,
10
1);
+ ret = cmpxchg(&test_val, val,
val+
1);
}
}
+//void (*fct)(void) = do_test;
+
static int ltt_test_init(void)
{
unsigned int i;
static int ltt_test_init(void)
{
unsigned int i;
@@
-32,22
+35,25
@@
static int ltt_test_init(void)
printk(KERN_ALERT "test init\n");
local_irq_save(flags);
printk(KERN_ALERT "test init\n");
local_irq_save(flags);
+ time1 = get_cycles();
for(i=0; i<NR_LOOPS; i++) {
for(i=0; i<NR_LOOPS; i++) {
- time1 = get_cycles();
+ //for(int j=0; j<10; j++) {
do_test();
do_test();
- time2 = get_cycles();
- time = time2 - time1;
- max_time = max(max_time, time);
- min_time = min(min_time, time);
- tot_time += time;
+ //}
+ //max_time = max(max_time, time);
+ //min_time = min(min_time, time);
+ //printk("val : %d\n", test_val);
}
}
+ time2 = get_cycles();
local_irq_restore(flags);
local_irq_restore(flags);
+ time = time2 - time1;
+ tot_time += time;
- printk(KERN_ALERT "test results : time
per probe
\n");
+ printk(KERN_ALERT "test results : time
for cmpxchg
\n");
printk(KERN_ALERT "number of loops : %d\n", NR_LOOPS);
printk(KERN_ALERT "total time : %llu\n", tot_time);
printk(KERN_ALERT "number of loops : %d\n", NR_LOOPS);
printk(KERN_ALERT "total time : %llu\n", tot_time);
- printk(KERN_ALERT "min : %llu\n", min_time);
- printk(KERN_ALERT "max : %llu\n", max_time);
+
//
printk(KERN_ALERT "min : %llu\n", min_time);
+
//
printk(KERN_ALERT "max : %llu\n", max_time);
printk(KERN_ALERT "test end\n");
printk(KERN_ALERT "test end\n");
This page took
0.029431 seconds
and
4
git commands to generate.