Changes:
xxxx/xx/xx: Version 9.1.7 - Sebastien Godard (sysstat <at> orange.fr)
+ INFO: stats_queue structure format has changed and is *not*
+ compatible with the previous one [+1]
* sar now tells sadc to read only the necessary groups of
activities.
+ * Added a new metric (number of tasks waiting for I/O) to
+ sar -q.
* [Ivana Varekova]: Fix segfaults on bogus localtime input.
* Fixed bogus CPU statistics output, which happened when
CPU user value from /proc/stat wasn't incremented whereas
expressed in blocks/s).
* No longer assume that device-mapper major number is 253.
Get the real number from /proc/devices file.
+ * DTD and XSD documents updated.
* [Kenichi Okuyama]: Small change to sar manual page.
* sar manual page updated.
* Code cleaned.
struct activity queue_act = {
.id = A_QUEUE,
.options = AO_COLLECTED,
- .magic = ACTIVITY_MAGIC_BASE,
+ .magic = ACTIVITY_MAGIC_BASE + 1,
.group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = NULL,
#ifdef SOURCE_SADF
.f_render = render_queue_stats,
.f_xml_print = xml_print_queue_stats,
- .hdr_line = "runq-sz;plist-sz;ldavg-1;ldavg-5;ldavg-15",
+ .hdr_line = "runq-sz;plist-sz;ldavg-1;ldavg-5;ldavg-15;blocked",
.name = "A_QUEUE",
#endif
.nr = 1,
-.TH SAR 1 "NOVEMBER 2010" Linux "Linux User's Manual" -*- nroff -*-
+.TH SAR 1 "DECEMBER 2010" Linux "Linux User's Manual" -*- nroff -*-
.SH NAME
sar \- Collect, report, or save system activity information.
.SH SYNOPSIS
.RS
System load average for the past 15 minutes.
.RE
+
+.B blocked
+.RS
+Number of tasks currently blocked, waiting for I/O to complete.
+.RE
.RE
.IP -r
Report memory utilization statistics.
struct stats_queue
*sqc = (struct stats_queue *) a->buf[curr];
static unsigned long long
- avg_nr_running = 0,
- avg_nr_threads = 0,
- avg_load_avg_1 = 0,
- avg_load_avg_5 = 0,
- avg_load_avg_15 = 0;
+ avg_nr_running = 0,
+ avg_nr_threads = 0,
+ avg_load_avg_1 = 0,
+ avg_load_avg_5 = 0,
+ avg_load_avg_15 = 0,
+ avg_procs_blocked = 0;
if (dis) {
- printf("\n%-11s runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15\n",
+ printf("\n%-11s runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked\n",
timestamp[!curr]);
}
if (!dispavg) {
/* Display instantaneous values */
- printf("%-11s %9lu %9u %9.2f %9.2f %9.2f\n", timestamp[curr],
+ printf("%-11s %9lu %9u %9.2f %9.2f %9.2f %9lu\n", timestamp[curr],
sqc->nr_running,
sqc->nr_threads,
(double) sqc->load_avg_1 / 100,
(double) sqc->load_avg_5 / 100,
- (double) sqc->load_avg_15 / 100);
+ (double) sqc->load_avg_15 / 100,
+ sqc->procs_blocked);
/* Will be used to compute the average */
- avg_nr_running += sqc->nr_running;
- avg_nr_threads += sqc->nr_threads;
- avg_load_avg_1 += sqc->load_avg_1;
- avg_load_avg_5 += sqc->load_avg_5;
- avg_load_avg_15 += sqc->load_avg_15;
+ avg_nr_running += sqc->nr_running;
+ avg_nr_threads += sqc->nr_threads;
+ avg_load_avg_1 += sqc->load_avg_1;
+ avg_load_avg_5 += sqc->load_avg_5;
+ avg_load_avg_15 += sqc->load_avg_15;
+ avg_procs_blocked += sqc->procs_blocked;
}
else {
/* Display average values */
- printf("%-11s %9.0f %9.0f %9.2f %9.2f %9.2f\n", timestamp[curr],
- (double) avg_nr_running / avg_count,
- (double) avg_nr_threads / avg_count,
- (double) avg_load_avg_1 / (avg_count * 100),
- (double) avg_load_avg_5 / (avg_count * 100),
- (double) avg_load_avg_15 / (avg_count * 100));
+ printf("%-11s %9.0f %9.0f %9.2f %9.2f %9.2f %9.0f\n", timestamp[curr],
+ (double) avg_nr_running / avg_count,
+ (double) avg_nr_threads / avg_count,
+ (double) avg_load_avg_1 / (avg_count * 100),
+ (double) avg_load_avg_5 / (avg_count * 100),
+ (double) avg_load_avg_15 / (avg_count * 100),
+ (double) avg_procs_blocked / avg_count);
/* Reset average counters */
avg_nr_running = avg_nr_threads = 0;
avg_load_avg_1 = avg_load_avg_5 = avg_load_avg_15 = 0;
+ avg_procs_blocked = 0;
}
}
/*
***************************************************************************
- * Read processes (tasks) creation and context switches statistics from
- * /proc/stat
+ * Read processes (tasks) creation and context switches statistics
+ * from /proc/stat.
*
* IN:
* @st_pcsw Structure where stats will be saved.
/*
***************************************************************************
- * Read queue and load statistics from /proc/loadavg.
+ * Read queue and load statistics from /proc/loadavg and /proc/stat.
*
* IN:
* @st_queue Structure where stats will be saved.
void read_loadavg(struct stats_queue *st_queue)
{
FILE *fp;
+ char line[8192];
int load_tmp[3];
if ((fp = fopen(LOADAVG, "r")) == NULL)
/* Do not take current process into account */
st_queue->nr_running--;
}
+
+ /* Read nr of tasks blocked from /proc/stat */
+ if ((fp = fopen(STAT, "r")) == NULL)
+ return;
+
+ while (fgets(line, 8192, fp) != NULL) {
+
+ if (!strncmp(line, "procs_blocked ", 14)) {
+ /* Read number of processes blocked */
+ sscanf(line + 14, "%lu", &st_queue->procs_blocked);
+ break;
+ }
+ }
+
+ fclose(fp);
}
/*
/* Structure for queue and load statistics */
struct stats_queue {
unsigned long nr_running __attribute__ ((aligned (8)));
+ unsigned long procs_blocked __attribute__ ((aligned (8)));
unsigned int load_avg_1 __attribute__ ((aligned (8)));
unsigned int load_avg_5 __attribute__ ((packed));
unsigned int load_avg_15 __attribute__ ((packed));
NOVAL,
(double) sqc->load_avg_5 / 100);
- render(isdb, pre, pt_newlin,
+ render(isdb, pre, PT_NOFLAG,
"-\tldavg-15", NULL, NULL,
NOVAL,
(double) sqc->load_avg_15 / 100);
+
+ render(isdb, pre, PT_USEINT | pt_newlin,
+ "-\tblocked", NULL, NULL,
+ sqc->procs_blocked, DNOVAL);
}
/*
#define S_O_DBD_OPTION 5
/* DTD version for XML output */
-#define XML_DTD_VERSION "2.9"
+#define XML_DTD_VERSION "2.10"
#endif /* _SADF_H */
<?xml version="1.0" encoding="UTF-8"?>
-<!--DTD v2.9 for sysstat. See sadf.h -->
+<!--DTD v2.10 for sysstat. See sadf.h -->
<!ELEMENT boot EMPTY>
<!ATTLIST boot
date CDATA #REQUIRED
ldavg-1 CDATA #REQUIRED
ldavg-5 CDATA #REQUIRED
ldavg-15 CDATA #REQUIRED
+ blocked CDATA #REQUIRED
>
<!ELEMENT restarts (boot+)>
<!ELEMENT comments (comment+)>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://pagesperso-orange.fr/sebastien.godard/sysstat" targetNamespace="http://pagesperso-orange.fr/sebastien.godard/sysstat" elementFormDefault="qualified">
-<xs:annotation><xs:appinfo>-- XML Schema v2.9 for sysstat. See sadf.h --</xs:appinfo></xs:annotation>
+<xs:annotation><xs:appinfo>-- XML Schema v2.10 for sysstat. See sadf.h --</xs:appinfo></xs:annotation>
<xs:element name="queue" type="queue-type"></xs:element>
<xs:attribute name="ldavg-1" type="hundredth-type"></xs:attribute>
<xs:attribute name="ldavg-5" type="hundredth-type"></xs:attribute>
<xs:attribute name="ldavg-15" type="hundredth-type"></xs:attribute>
+ <xs:attribute name="blocked" type="xs:nonNegativeInteger"></xs:attribute>
</xs:complexType>
<xs:element name="kernel" type="kernel-type"></xs:element>
"plist-sz=\"%u\" "
"ldavg-1=\"%.2f\" "
"ldavg-5=\"%.2f\" "
- "ldavg-15=\"%.2f\"/>",
+ "ldavg-15=\"%.2f\" "
+ "blocked=\"%lu\"/>",
sqc->nr_running,
sqc->nr_threads,
(double) sqc->load_avg_1 / 100,
(double) sqc->load_avg_5 / 100,
- (double) sqc->load_avg_15 / 100);
+ (double) sqc->load_avg_15 / 100,
+ sqc->procs_blocked);
}
/*