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