VirtualBox

source: vbox/trunk/src/VBox/VMM/dtrace/int-1.d@ 106579

Last change on this file since 106579 was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/* $Id: int-1.d 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * DTracing VBox - Interrupt Experiment #1.
4 */
5
6/*
7 * Copyright (C) 2012-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#pragma D option quiet
29
30uint64_t g_aStarts[uint32_t];
31uint64_t g_cUntaggedHighs;
32uint64_t g_cUntaggedGets;
33uint64_t g_cMissedHighs;
34
35inline uint32_t kfDevIdMask = 0x3ff;
36
37
38/*
39 * Timestamp the when the device raises the IRQ.
40 */
41vboxvmm*:::pdm-irq-high,vboxvmm*:::pdm-irq-hilo
42/args[1] != 0/
43{
44 /*printf("high: tag=%#x src=%d %llx -> %llx\n", args[1], args[2], g_aStarts[args[1]], timestamp);*/
45 g_aStarts[args[1]] = timestamp;
46}
47
48vboxvmm*:::pdm-irq-high,vboxvmm*:::pdm-irq-hilo
49/args[1] == 0/
50{
51 g_cUntaggedHighs++;
52}
53
54/*
55 * Catch the CPU getting the IRQ from the (A)PIC and preparing for injection.
56 */
57vboxvmm*:::pdm-irq-get
58/g_aStarts[args[1]] == 0 && args[1] != 0/
59{
60 printf("get: tag=%#x src=%d %llx - %llx = %llx\n", args[1], args[2], timestamp, g_aStarts[args[1]], timestamp - g_aStarts[args[1]]);
61 @g_MissedHighs[args[3], args[2] & kfDevIdMask] = count();
62 g_cMissedHighs++;
63}
64
65vboxvmm*:::pdm-irq-get
66/g_aStarts[args[1]] > 0 && args[1] != 0/
67{
68 /*printf("get: tag=%#x src=%d %llx - %llx = %llx\n", args[1], args[2], timestamp, g_aStarts[args[1]], timestamp - g_aStarts[args[1]]);*/
69 @g_Interrupts[args[3], args[2] & kfDevIdMask] = count();
70 @g_DispAvg[ args[3], args[2] & kfDevIdMask] = avg(timestamp - g_aStarts[args[1]]);
71 @g_DispMax[ args[3], args[2] & kfDevIdMask] = max(timestamp - g_aStarts[args[1]]);
72 @g_DispMin[ args[3], args[2] & kfDevIdMask] = min(timestamp - g_aStarts[args[1]]);
73 g_aStarts[args[1]] = 0;
74 g_cHits++;
75}
76
77vboxvmm*:::pdm-irq-get
78/args[1] == 0/
79{
80 @g_UntaggedGets[args[3]] = count();
81 g_cUntaggedGets++;
82}
83
84vboxvmm*:::pdm-irq-get
85/args[2] > kfDevIdMask/
86{
87 @g_Shared[args[3], args[2] & kfDevIdMask] = count();
88}
89
90/* For the time being, quit after 256 interrupts. */
91vboxvmm*:::pdm-irq-get
92/g_cHits >= 256/
93{
94 exit(0);
95}
96
97/*
98 * Catch the device clearing the IRQ.
99 */
100
101
102/*
103 * Report.
104 */
105END
106{
107 printf("\nInterrupt distribution:\n");
108 printa(" irq %3d dev %2d %@12u\n", @g_Interrupts);
109 printf("Interrupt sharing (devices detect pushing a line high at the same time):\n");
110 printa(" irq %3d dev %2d %@12u\n", @g_Shared);
111 printf("Minimum dispatch latency:\n");
112 printa(" irq %3d dev %2d %@12u ns\n", @g_DispMin);
113 printf("Average dispatch latency:\n");
114 printa(" irq %3d dev %2d %@12u ns\n", @g_DispAvg);
115 printf("Maximum dispatch latency:\n");
116 printa(" irq %3d dev %2d %@12u ns\n", @g_DispMax);
117}
118END
119/g_cUntaggedHighs > 0/
120{
121 printf("Untagged highs: %u\n", g_cUntaggedHighs);
122}
123END
124/g_cUntaggedGets > 0/
125{
126 printf("Untagged gets: %u\n", g_cUntaggedGets);
127 printa(" irq %3d %@12u\n", @g_UntaggedGets);
128}
129END
130/g_cMissedHighs > 0/
131{
132 printf("Missed (or shared?) highs: %u\n", g_cMissedHighs);
133 printa(" irq %3d dev %2d %@12u\n", @g_MissedHighs);
134}
135
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette