-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
return *p;
}
-static void
-lst_timeval_diff(struct timeval *tv1,
- struct timeval *tv2, struct timeval *df)
-{
- if (tv1->tv_usec >= tv2->tv_usec) {
- df->tv_sec = tv1->tv_sec - tv2->tv_sec;
- df->tv_usec = tv1->tv_usec - tv2->tv_usec;
- return;
- }
-
- df->tv_sec = tv1->tv_sec - 1 - tv2->tv_sec;
- df->tv_usec = tv1->tv_sec + 1000000 - tv2->tv_usec;
-
- return;
-}
-
void
lst_cal_lnet_stat(float delta, lnet_counters_t *lnet_new,
lnet_counters_t *lnet_old)
srpc_counters_t *srpc_old;
lnet_counters_t *lnet_new;
lnet_counters_t *lnet_old;
- struct timeval tv;
float delta;
int errcount = 0;
lnet_new = (lnet_counters_t *)((char *)srpc_new + sizeof(*srpc_new));
lnet_old = (lnet_counters_t *)((char *)srpc_old + sizeof(*srpc_old));
- lst_timeval_diff(&new->rpe_stamp, &old->rpe_stamp, &tv);
+ /* use the timestamp from the remote node, not our rpe_stamp
+ * from when we copied up the data out of the kernel */
- delta = tv.tv_sec + (float)tv.tv_usec/1000000;
+ delta = (float) (sfwk_new->running_ms -
+ sfwk_old->running_ms) / 1000;
if (!lnet) /* TODO */
continue;
int optidx = 0;
int timeout = 5; /* default timeout, 5 sec */
int delay = 5; /* default delay, 5 sec */
+ int count = -1; /* run forever */
int lnet = 1; /* lnet stat by default */
int bwrt = 0;
int rdwr = 0;
{
{"timeout", required_argument, 0, 't' },
{"delay" , required_argument, 0, 'd' },
+ {"count" , required_argument, 0, 'o' },
{"lnet" , no_argument, 0, 'l' },
{"rpc" , no_argument, 0, 'c' },
{"bw" , no_argument, 0, 'b' },
case 'd':
delay = atoi(optarg);
break;
+ case 'o':
+ count = atoi(optarg);
+ break;
case 'l':
lnet = 1;
break;
return -1;
}
+ if (count < -1) {
+ fprintf(stderr, "Invalid count value\n");
+ return -1;
+ }
+
+ /* extra count to get first data point */
+ if (count != -1)
+ count++;
+
CFS_INIT_LIST_HEAD(&head);
while (optind < argc) {
cfs_list_add_tail(&srp->srp_link, &head);
}
- while (1) {
+ do {
time_t now = time(NULL);
if (now - last < delay) {
}
idx = 1 - idx;
- }
+
+ if (count > 0)
+ count--;
+ } while (count == -1 || count > 0);
out:
while (!cfs_list_empty(&head)) {
cfs_list_for_each_entry_typed(srp, &head, lst_stat_req_param_t,
srp_link) {
rc = lst_stat_ioctl(srp->srp_name, srp->srp_count,
- srp->srp_ids, 5, &srp->srp_result[0]);
+ srp->srp_ids, 10, &srp->srp_result[0]);
if (rc == -1) {
lst_print_error(srp->srp_name, "Failed to show errors of %s: %s\n",
"Usage: lst list_group [--active] [--busy] [--down] [--unknown] GROUP ..." },
{"stat", jt_lst_stat, NULL,
"Usage: lst stat [--bw] [--rate] [--read] [--write] [--max] [--min] [--avg] "
- " [--timeout #] [--delay #] GROUP [GROUP]" },
+ " [--timeout #] [--delay #] [--count #] GROUP [GROUP]" },
{"show_error", jt_lst_show_error, NULL,
"Usage: lst show_error NAME | IDS ..." },
{"add_batch", jt_lst_add_batch, NULL,