File tree 2 files changed +24
-1
lines changed
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,24 @@ let date_of_iso8601 () = Clock.Date.of_iso8601 date
64
64
let local_session_hook () =
65
65
Xapi_local_session. local_session_hook ~__context ~session_id: Ref. null
66
66
67
+ let atomic = Atomic. make 0
68
+
69
+ let atomic_inc () = Atomic. incr atomic
70
+
71
+ let mutex = Mutex. create ()
72
+
73
+ let locked_ref = ref 0
74
+
75
+ let with_lock = Xapi_stdext_threads.Threadext.Mutex. execute
76
+
77
+ let inc_locked () = incr locked_ref
78
+
79
+ let inc_with_mutex () = with_lock mutex inc_locked
80
+
81
+ let noop () = Sys. opaque_identity ()
82
+
83
+ let db_lock_uncontended () : unit = Xapi_database.Db_lock. with_lock noop
84
+
67
85
let benchmarks =
68
86
[
69
87
Test. make ~name: " local_session_hook" (Staged. stage local_session_hook)
@@ -73,6 +91,10 @@ let benchmarks =
73
91
; Test. make ~name: " Db.Pool.get_all_records" (Staged. stage get_all)
74
92
; Test. make ~name: " pool_t -> Rpc.t" (Staged. stage serialize)
75
93
; Test. make ~name: " Rpc.t -> pool_t" (Staged. stage deserialize)
94
+ ; Test. make ~name: " Atomic.incr" (Staged. stage atomic_inc)
95
+ ; Test. make ~name: " Mutex+incr" (Staged. stage inc_with_mutex)
96
+ ; Test. make ~name: " Db_lock.with_lock uncontended"
97
+ (Staged. stage db_lock_uncontended)
76
98
]
77
99
78
100
let () = Bechamel_simple_cli. cli benchmarks
Original file line number Diff line number Diff line change 27
27
log
28
28
xapi_database
29
29
xapi_datamodel
30
- xapi_internal))
30
+ xapi_internal
31
+ xapi-stdext-threads))
You can’t perform that action at this time.
0 commit comments