Index: /trunk/src/VBox/VMM/dtrace/int-1.d
===================================================================
--- /trunk/src/VBox/VMM/dtrace/int-1.d	(revision 40954)
+++ /trunk/src/VBox/VMM/dtrace/int-1.d	(revision 40955)
@@ -18,7 +18,15 @@
 #pragma D option quiet
 
-uint64_t        g_aStarts[uint32_t];
-unsigned int    g_cHits;
+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/
@@ -28,12 +36,29 @@
 }
 
+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/
 {
-    @interrupts[args[3], args[2]] = count();
     /*printf("get:  tag=%#x src=%d %llx - %llx = %llx\n", args[1], args[2], timestamp, g_aStarts[args[1]], timestamp - g_aStarts[args[1]]);*/
-    @dispavg[args[3], args[2]]  = avg(timestamp - g_aStarts[args[1]]);
-    @dispmax[args[3], args[2]]  = max(timestamp - g_aStarts[args[1]]);
-    @dispmin[args[3], args[2]]  = min(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++;
@@ -41,19 +66,60 @@
 
 vboxvmm*:::pdm-irq-get
-/g_cHits >= 512/
+/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:");
-    printa(@interrupts);
-    printf("Average dispatch latency:");
-    printa(@dispavg);
-    printf("Minimax dispatch latency:");
-    printa(@dispmin);
-    printf("Maximum dispatch latency:");
-    printa(@dispmax);
+    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);
+}
+
