1 | /* $Id: int-1.d 76553 2019-01-01 01:45:53Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DTracing VBox - Interrupt Experiment #1.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #pragma D option quiet
|
---|
19 |
|
---|
20 | uint64_t g_aStarts[uint32_t];
|
---|
21 | uint64_t g_cUntaggedHighs;
|
---|
22 | uint64_t g_cUntaggedGets;
|
---|
23 | uint64_t g_cMissedHighs;
|
---|
24 |
|
---|
25 | inline uint32_t kfDevIdMask = 0x3ff;
|
---|
26 |
|
---|
27 |
|
---|
28 | /*
|
---|
29 | * Timestamp the when the device raises the IRQ.
|
---|
30 | */
|
---|
31 | vboxvmm*:::pdm-irq-high,vboxvmm*:::pdm-irq-hilo
|
---|
32 | /args[1] != 0/
|
---|
33 | {
|
---|
34 | /*printf("high: tag=%#x src=%d %llx -> %llx\n", args[1], args[2], g_aStarts[args[1]], timestamp);*/
|
---|
35 | g_aStarts[args[1]] = timestamp;
|
---|
36 | }
|
---|
37 |
|
---|
38 | vboxvmm*:::pdm-irq-high,vboxvmm*:::pdm-irq-hilo
|
---|
39 | /args[1] == 0/
|
---|
40 | {
|
---|
41 | g_cUntaggedHighs++;
|
---|
42 | }
|
---|
43 |
|
---|
44 | /*
|
---|
45 | * Catch the CPU getting the IRQ from the (A)PIC and preparing for injection.
|
---|
46 | */
|
---|
47 | vboxvmm*:::pdm-irq-get
|
---|
48 | /g_aStarts[args[1]] == 0 && args[1] != 0/
|
---|
49 | {
|
---|
50 | printf("get: tag=%#x src=%d %llx - %llx = %llx\n", args[1], args[2], timestamp, g_aStarts[args[1]], timestamp - g_aStarts[args[1]]);
|
---|
51 | @g_MissedHighs[args[3], args[2] & kfDevIdMask] = count();
|
---|
52 | g_cMissedHighs++;
|
---|
53 | }
|
---|
54 |
|
---|
55 | vboxvmm*:::pdm-irq-get
|
---|
56 | /g_aStarts[args[1]] > 0 && args[1] != 0/
|
---|
57 | {
|
---|
58 | /*printf("get: tag=%#x src=%d %llx - %llx = %llx\n", args[1], args[2], timestamp, g_aStarts[args[1]], timestamp - g_aStarts[args[1]]);*/
|
---|
59 | @g_Interrupts[args[3], args[2] & kfDevIdMask] = count();
|
---|
60 | @g_DispAvg[ args[3], args[2] & kfDevIdMask] = avg(timestamp - g_aStarts[args[1]]);
|
---|
61 | @g_DispMax[ args[3], args[2] & kfDevIdMask] = max(timestamp - g_aStarts[args[1]]);
|
---|
62 | @g_DispMin[ args[3], args[2] & kfDevIdMask] = min(timestamp - g_aStarts[args[1]]);
|
---|
63 | g_aStarts[args[1]] = 0;
|
---|
64 | g_cHits++;
|
---|
65 | }
|
---|
66 |
|
---|
67 | vboxvmm*:::pdm-irq-get
|
---|
68 | /args[1] == 0/
|
---|
69 | {
|
---|
70 | @g_UntaggedGets[args[3]] = count();
|
---|
71 | g_cUntaggedGets++;
|
---|
72 | }
|
---|
73 |
|
---|
74 | vboxvmm*:::pdm-irq-get
|
---|
75 | /args[2] > kfDevIdMask/
|
---|
76 | {
|
---|
77 | @g_Shared[args[3], args[2] & kfDevIdMask] = count();
|
---|
78 | }
|
---|
79 |
|
---|
80 | /* For the time being, quit after 256 interrupts. */
|
---|
81 | vboxvmm*:::pdm-irq-get
|
---|
82 | /g_cHits >= 256/
|
---|
83 | {
|
---|
84 | exit(0);
|
---|
85 | }
|
---|
86 |
|
---|
87 | /*
|
---|
88 | * Catch the device clearing the IRQ.
|
---|
89 | */
|
---|
90 |
|
---|
91 |
|
---|
92 | /*
|
---|
93 | * Report.
|
---|
94 | */
|
---|
95 | END
|
---|
96 | {
|
---|
97 | printf("\nInterrupt distribution:\n");
|
---|
98 | printa(" irq %3d dev %2d %@12u\n", @g_Interrupts);
|
---|
99 | printf("Interrupt sharing (devices detect pushing a line high at the same time):\n");
|
---|
100 | printa(" irq %3d dev %2d %@12u\n", @g_Shared);
|
---|
101 | printf("Minimum dispatch latency:\n");
|
---|
102 | printa(" irq %3d dev %2d %@12u ns\n", @g_DispMin);
|
---|
103 | printf("Average dispatch latency:\n");
|
---|
104 | printa(" irq %3d dev %2d %@12u ns\n", @g_DispAvg);
|
---|
105 | printf("Maximum dispatch latency:\n");
|
---|
106 | printa(" irq %3d dev %2d %@12u ns\n", @g_DispMax);
|
---|
107 | }
|
---|
108 | END
|
---|
109 | /g_cUntaggedHighs > 0/
|
---|
110 | {
|
---|
111 | printf("Untagged highs: %u\n", g_cUntaggedHighs);
|
---|
112 | }
|
---|
113 | END
|
---|
114 | /g_cUntaggedGets > 0/
|
---|
115 | {
|
---|
116 | printf("Untagged gets: %u\n", g_cUntaggedGets);
|
---|
117 | printa(" irq %3d %@12u\n", @g_UntaggedGets);
|
---|
118 | }
|
---|
119 | END
|
---|
120 | /g_cMissedHighs > 0/
|
---|
121 | {
|
---|
122 | printf("Missed (or shared?) highs: %u\n", g_cMissedHighs);
|
---|
123 | printa(" irq %3d dev %2d %@12u\n", @g_MissedHighs);
|
---|
124 | }
|
---|
125 |
|
---|