patch-2.2.18 linux/arch/s390/tools/hwc/hwc_measure.c
Next file: linux/arch/s390/tools/hwc_cntl_key/Makefile
Previous file: linux/arch/s390/tools/hwc/hwc_cntl_key.c
Back to the patch index
Back to the overall index
- Lines: 80
- Date:
Wed Nov 8 23:04:59 2000
- Orig file:
v2.2.17/arch/s390/tools/hwc/hwc_measure.c
- Orig date:
Thu Jan 1 01:00:00 1970
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/arch/s390/tools/hwc/hwc_measure.c linux/arch/s390/tools/hwc/hwc_measure.c
@@ -0,0 +1,79 @@
+/*
+ * small application for HWC measurement
+ *
+ * Copyright (C) 2000 IBM Corporation
+ * Author(s): Martin Peschke <peschke@fh-brandenburg.de>
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+/* everything about the HWC low level driver ioctl-commands */
+#include "../../../../drivers/s390/char/hwc_rw.h"
+
+/* standard input, should be our HWC tty */
+#define DESCRIPTOR 0
+
+int main(int argc, char *argv[], char *env[])
+{
+ ioctl_meas_t measured = 0;
+ signed int retval = 0;
+
+ if (argc = 2) {
+
+ if (strcmp(argv[1], "lines") == 0) {
+ retval = ioctl(DESCRIPTOR, TIOCHWCGMEASL,
+ &measured);
+ if (retval < 0)
+ return errno;
+ else {
+ printf("%ld\n", measured);
+ return retval;
+ }
+ }
+
+ if (strcmp(argv[1], "chars") == 0) {
+ retval = ioctl(DESCRIPTOR, TIOCHWCGMEASC,
+ &measured);
+ if (retval < 0)
+ return errno;
+ else {
+ printf("%ld\n", measured);
+ return retval;
+ }
+ }
+
+ if (strcmp(argv[1], "wcalls") == 0) {
+ retval = ioctl(DESCRIPTOR, TIOCHWCGMEASS,
+ &measured);
+ if (retval < 0)
+ return errno;
+ else {
+ printf("%ld\n", measured);
+ return retval;
+ }
+ }
+
+ if (strcmp(argv[1], "reset") == 0) {
+ retval = ioctl(DESCRIPTOR, TIOCHWCSMEAS);
+ if (retval < 0)
+ return errno;
+ else return retval;
+ }
+ }
+
+ printf("usage:\n");
+ printf(" hwc_measure lines "
+ "(prints # of measured lines) or\n");
+ printf(" hwc_measure_chars "
+ "(prints # of measured characters) or\n");
+ printf(" hwc_measure wcalls "
+ "(prints # of measured write calls to HWC interface) or\n");
+ printf(" hwc_measure reset "
+ "(resets measurement counters)\n");
+
+ return -1;
+}
+
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)