File tree 4 files changed +28
-4
lines changed
4 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ module Kind = struct
7
7
| Syscall
8
8
| Sysret
9
9
| Hardware_interrupt
10
+ | Interrupt
10
11
| Iret
11
12
| Jump
12
13
[@@ deriving sexp , compare , bin_io ]
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ module Kind : sig
7
7
| Syscall
8
8
| Sysret
9
9
| Hardware_interrupt
10
+ | Interrupt
10
11
| Iret
11
12
| Jump
12
13
[@@ deriving sexp , compare ]
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ let perf_callstack_entry_re = Re.Perl.re "^\t *([0-9a-f]+) (.*)$" |> Re.compile
22
22
23
23
let perf_branches_event_re =
24
24
Re.Perl. re
25
- {|^ * (call| return| tr strt| syscall| sysret| hw int | iret| tr end| tr strt tr end| tr end (?: call| return| syscall| sysret| iret)| jmp| jcc) + ([0-9 a- f]+ ) (.* ) => + ([0-9 a- f]+ ) (.* )$| }
25
+ {|^ * (call| return| tr strt| syscall| sysret| hw int | iret| int | tr end| tr strt tr end| tr end (?: call| return| syscall| sysret| iret)| jmp| jcc) + ([0-9 a- f]+ ) (.* ) => + ([0-9 a- f]+ ) (.* )$| }
26
26
|> Re. compile
27
27
;;
28
28
@@ -243,6 +243,7 @@ let parse_perf_branches_event ?perf_maps (thread : Event.Thread.t) time line : E
243
243
match String. strip kind with
244
244
| "call" -> Some Call
245
245
| "return" -> Some Return
246
+ | "int" -> Some Interrupt
246
247
| "jmp" -> Some Jump
247
248
| "jcc" -> Some Jump
248
249
| "syscall" -> Some Syscall
@@ -495,6 +496,19 @@ let%test_module _ =
495
496
(data (Trace (kind Call ) (src 0x56234f77576b ) (dst 0x56234f4bc7a0 )))))) | }]
496
497
;;
497
498
499
+ let % expect_test " software interrupts" =
500
+ check
501
+ " 1907478/1909463 457407.880965552: 1 \
502
+ branches:uH: int 564aa58813d4 \
503
+ Builtins_RunMicrotasks+0x554 (/usr/local/bin/workload) => 564aa584fa00 \
504
+ Builtins_Call_ReceiverIsNotNullOrUndefined+0x0 (/usr/local/bin/workload)" ;
505
+ [% expect
506
+ {|
507
+ ((Ok
508
+ ((thread ((pid (1907478 )) (tid (1909463 )))) (time 5 d7h3m27.880965552 s)
509
+ (data (Trace (kind Interrupt ) (src 0x564aa58813d4 ) (dst 0x564aa584fa00 )))))) | }]
510
+ ;;
511
+
498
512
let % expect_test " decode error with a timestamp" =
499
513
check
500
514
" instruction trace error type 1 time 47170.086912826 cpu -1 pid 293415 tid \
Original file line number Diff line number Diff line change @@ -1004,9 +1004,17 @@ let write_event (T t) ?events_writer event =
1004
1004
~time ;
1005
1005
(match kind, trace_state_change with
1006
1006
| Some Call , (None | Some End ) -> call t thread_info ~time ~location: dst
1007
- | ( Some (Call | Syscall | Return | Hardware_interrupt | Iret | Sysret | Jump )
1007
+ | ( Some
1008
+ ( Call
1009
+ | Syscall
1010
+ | Return
1011
+ | Hardware_interrupt
1012
+ | Iret
1013
+ | Interrupt
1014
+ | Sysret
1015
+ | Jump )
1008
1016
, Some Start )
1009
- | Some (Hardware_interrupt | Jump ), Some End ->
1017
+ | Some (Hardware_interrupt | Jump | Interrupt ), Some End ->
1010
1018
raise_s
1011
1019
[% message
1012
1020
" BUG: magic-trace devs thought this event was impossible, but you just \
@@ -1093,7 +1101,7 @@ let write_event (T t) ?events_writer event =
1093
1101
~addr: dst.instruction_pointer
1094
1102
~time ;
1095
1103
check_current_symbol t thread_info ~time dst)
1096
- | Some Jump , None ->
1104
+ | Some ( Jump | Interrupt ) , None ->
1097
1105
Ocaml_hacks. check_current_symbol_track_entertraps t thread_info ~time dst
1098
1106
(* (None, _) comes up when perf spews something magic-trace doesn't recognize.
1099
1107
Instead of crashing, ignore it and keep going. *)
You can’t perform that action at this time.
0 commit comments