|
6 | 6 | using System.Linq; |
7 | 7 | using Xunit; |
8 | 8 | using System.Linq.Expressions; |
| 9 | +using System; |
9 | 10 |
|
10 | 11 | namespace LinuxTracingTests |
11 | 12 | { |
@@ -65,7 +66,7 @@ ScheduleSwitch[] switches |
65 | 66 | Assert.Equal(pids[i], linuxEvent.ProcessID); |
66 | 67 | Assert.Equal(tids[i], linuxEvent.ThreadID); |
67 | 68 | Assert.Equal(cpus[i], linuxEvent.CpuNumber); |
68 | | - Assert.Equal(times[i], linuxEvent.TimeMSec); |
| 69 | + Assert.True(Math.Abs(times[i] - linuxEvent.TimeMSec) <= 0.0001); |
69 | 70 | Assert.Equal(timeProperties[i], linuxEvent.TimeProperty); |
70 | 71 | Assert.Equal(events[i], linuxEvent.EventName); |
71 | 72 | Assert.Equal(eventProperties[i], linuxEvent.EventProperty); |
@@ -257,5 +258,56 @@ public void CornerCaseProcessNames() |
257 | 258 | eventKinds: null, |
258 | 259 | switches: null); |
259 | 260 | } |
| 261 | + |
| 262 | + [Fact] |
| 263 | + public void DiskIoNoStacks() |
| 264 | + { |
| 265 | + string path = Constants.GetTestingPerfDumpPath("disk_io_no_stacks"); |
| 266 | + HeaderTest(path, blockedTime: false, |
| 267 | + commands: new string[] { "fio", "swapper", "fio", "swapper" }, |
| 268 | + pids: new int[] { 236193, 0, 236193, 0 }, |
| 269 | + tids: new int[] { 236193, 0, 236193, 0 }, |
| 270 | + cpus: new int[] { 21, 12, 21, 12 }, |
| 271 | + times: new double[] { 1791.544, 1791.615, 1791.628, 1791.699 }, |
| 272 | + timeProperties: new int[] { 1, 1, 1, 1 }, |
| 273 | + events: new string[] { "block", "block", "block", "block" }, |
| 274 | + eventProperties: new string[] { "block_rq_issue: 259,76 R 4096 () 57622160 + 8 [fio] ffffffff8beead90 blk_mq_start_request ([kernel.kallsyms])", "block_rq_complete: 259,76 R () 57622160 + 8 [0] ffffffff8bee2b4c blk_update_request ([kernel.kallsyms])", "block_rq_issue: 259,76 R 4096 () 82612968 + 8 [fio] ffffffff8beead90 blk_mq_start_request ([kernel.kallsyms])", "block_rq_complete: 259,76 R () 82612968 + 8 [0] ffffffff8bee2b4c blk_update_request ([kernel.kallsyms])" }, |
| 275 | + eventKinds: new EventKind[] { EventKind.BlockRequestIssue, EventKind.BlockRequestComplete, EventKind.BlockRequestIssue, EventKind.BlockRequestComplete }, |
| 276 | + switches: null); |
| 277 | + } |
| 278 | + |
| 279 | + [Fact] |
| 280 | + public void OneWakeup() |
| 281 | + { |
| 282 | + string path = Constants.GetTestingPerfDumpPath("one_wakeup"); |
| 283 | + HeaderTest(path, blockedTime: false, |
| 284 | + commands: new string[] { "swapper", "swapper" }, |
| 285 | + pids: new int[] { 0, 0 }, |
| 286 | + tids: new int[] { 0, 0 }, |
| 287 | + cpus: new int[] { 9, 9 }, |
| 288 | + times: new double[] { 0.0, 0.0 }, |
| 289 | + timeProperties: new int[] { 1, 1 }, |
| 290 | + events: new string[] { "sched", "sched" }, |
| 291 | + eventProperties: new string[] { "sched_wakeup: comm=fio pid=243615 prio=120 target_cpu=031 ffffffff8bad311d ttwu_do_wakeup ([kernel.kallsyms])", "sched_wakeup: task fio:243615 [120] success=1 [031] ffffffff8bad311d ttwu_do_wakeup ([kernel.kallsyms])" }, |
| 292 | + eventKinds: new EventKind[] { EventKind.Wakeup, EventKind.Wakeup }, |
| 293 | + switches: null); |
| 294 | + } |
| 295 | + |
| 296 | + [Fact] |
| 297 | + public void ExecProcess() |
| 298 | + { |
| 299 | + string path = Constants.GetTestingPerfDumpPath("exec_process"); |
| 300 | + HeaderTest(path, blockedTime: false, |
| 301 | + commands: new string[] { "probe-bcache" }, |
| 302 | + pids: new int[] { 286053, 286053 }, |
| 303 | + tids: new int[] { 286053, 286053 }, |
| 304 | + cpus: new int[] { 3, 3 }, |
| 305 | + times: new double[] { 0.0, 0.0 }, |
| 306 | + timeProperties: new int[] { 1, 1 }, |
| 307 | + events: new string[] { "sched" }, |
| 308 | + eventProperties: new string[] { "sched_process_exec: filename=/lib/udev/probe-bcache pid=286053 old_pid=286053" }, |
| 309 | + eventKinds: new EventKind[] { EventKind.ProcessExec }, |
| 310 | + switches: null); |
| 311 | + } |
260 | 312 | } |
261 | 313 | } |
0 commit comments