void pcp_def_irq_metrics(struct activity *a)
{
#ifdef HAVE_PCP
- if (a->bitmap->b_array[0] & 1) {
- /* Interrupt "sum" */
- pmiAddMetric("kernel.all.intr",
- PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
- pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+ int i, first = TRUE;
+ char buf[64];
+ pmInDom indom;
+
+ for (i = 0; (i < a->nr_ini) && (i < a->bitmap->b_size + 1); i++) {
+
+ /* Should current interrupt (including int "sum") be displayed? */
+ if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
+
+ if (!i) {
+ /* Interrupt "sum" */
+ pmiAddMetric("kernel.all.intr",
+ PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+ }
+ else {
+ if (first) {
+ indom = pmInDom_build(0, PM_INDOM_INT);
+
+ pmiAddMetric("kernel.all.int.count",
+ PM_IN_NULL, PM_TYPE_FLOAT, indom, PM_SEM_INSTANT,
+ pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+ first = FALSE;
+ }
+ sprintf(buf, "int%d", i - 1);
+ pmiAddInstance(indom, buf, i - 1);
+ }
+ }
}
#endif /* HAVE_PCP */
}
#define PM_INDOM_QUEUE 1
#define PM_INDOM_NET_DEV 2
#define PM_INDOM_SERIAL 3
+#define PM_INDOM_INT 4
#endif /* _PCP_DEF_METRICS_H */
struct record_header *record_hdr)
{
#ifdef HAVE_PCP
- char buf[64];
- struct stats_irq
- *sic = (struct stats_irq *) a->buf[curr],
- *sip = (struct stats_irq *) a->buf[!curr];
+ char buf[64], intno[64];
+ int i;
+ struct stats_irq *sic, *sip;
- snprintf(buf, sizeof(buf), "%f",
- S_VALUE(sip->irq_nr, sic->irq_nr, itv));
- pmiPutValue("kernel.all.intr", NULL, buf);
+ for (i = 0; (i < a->nr[curr]) && (i < a->bitmap->b_size + 1); i++) {
+
+ sic = (struct stats_irq *) ((char *) a->buf[curr] + i * a->msize);
+ sip = (struct stats_irq *) ((char *) a->buf[!curr] + i * a->msize);
+
+ /* Should current interrupt (including int "sum") be displayed? */
+ if (a->bitmap->b_array[i >> 3] & (1 << (i & 0x07))) {
+
+ if (!i) {
+ /* This is interrupt "sum" */
+ snprintf(buf, sizeof(buf), "%f",
+ S_VALUE(sip->irq_nr, sic->irq_nr, itv));
+ pmiPutValue("kernel.all.intr", NULL, buf);
+ }
+ else {
+ sprintf(intno, "int%d", i - 1);
+ snprintf(buf, sizeof(buf), "%f",
+ S_VALUE(sip->irq_nr, sic->irq_nr, itv));
+ pmiPutValue("kernel.all.int.count", intno, buf);
+ }
+ }
+ }
#endif /* HAVE_PCP */
}