#define sfw_unpack_fw_counters(fc) \
do { \
- __swab32s(&(fc).brw_errors); \
- __swab32s(&(fc).ping_errors); \
- __swab32s(&(fc).active_tests); \
+ __swab32s(&(fc).running_ms); \
__swab32s(&(fc).active_batches); \
__swab32s(&(fc).zombie_sessions); \
+ __swab32s(&(fc).brw_errors); \
+ __swab32s(&(fc).ping_errors); \
} while (0)
#define sfw_unpack_rpc_counters(rc) \
sn->sn_timer_active = 0;
sn->sn_id = sid;
sn->sn_timeout = session_timeout;
+ sn->sn_started = cfs_time_current();
timer->stt_data = sn;
timer->stt_func = sfw_session_expired;
sfw_session_t *sn = sfw_data.fw_session;
sfw_counters_t *cnt = &reply->str_fw;
sfw_batch_t *bat;
+ struct timeval tv;
reply->str_sid = (sn == NULL) ? LST_INVALID_SID : sn->sn_id;
srpc_get_counters(&reply->str_rpc);
+ /* send over the msecs since the session was started
+ - with 32 bits to send, this is ~49 days */
+ cfs_duration_usec(cfs_time_sub(cfs_time_current(),
+ sn->sn_started), &tv);
+
+ cnt->running_ms = (__u32)(tv.tv_sec * 1000 + tv.tv_usec / 1000);
cnt->brw_errors = cfs_atomic_read(&sn->sn_brw_errors);
cnt->ping_errors = cfs_atomic_read(&sn->sn_ping_errors);
cnt->zombie_sessions = cfs_atomic_read(&sfw_data.fw_nzombies);
- cnt->active_tests = cnt->active_batches = 0;
+ cnt->active_batches = 0;
cfs_list_for_each_entry_typed (bat, &sn->sn_batches,
sfw_batch_t, bat_list) {
- int n = cfs_atomic_read(&bat->bat_nactive);
-
- if (n > 0) {
+ if (cfs_atomic_read(&bat->bat_nactive) > 0)
cnt->active_batches++;
- cnt->active_tests += n;
- }
}
reply->str_status = 0;
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;