mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
afsmonitor: avoid showing full perf stats garbage
Unfortunately, the full perf stats contain timeval structures which do not have the same size everywhere. Avoid displaying gargbage, but at least try to show the overall stats. Change-Id: I9245b333ac15212194490e1a3f11b7c98dfaadda Reviewed-on: http://gerrit.openafs.org/1730 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
76a1088782
commit
7214af16a9
@ -368,14 +368,6 @@ Print_fs_FullPerfInfo(struct xstat_fs_ProbeResults *a_fs_Results)
|
||||
char *printableTime; /*Ptr to printable time string */
|
||||
time_t probeTime;
|
||||
|
||||
numLongs = a_fs_Results->data.AFS_CollData_len;
|
||||
if (numLongs != fullPerfLongs) {
|
||||
fprintf(fs_outFD,
|
||||
" ** Data size mismatch in full performance collection!\n");
|
||||
fprintf(fs_outFD, " ** Expecting %d, got %d\n", fullPerfLongs,
|
||||
numLongs);
|
||||
return;
|
||||
}
|
||||
|
||||
probeTime = a_fs_Results->probeTime;
|
||||
printableTime = ctime(&probeTime);
|
||||
@ -388,8 +380,24 @@ Print_fs_FullPerfInfo(struct xstat_fs_ProbeResults *a_fs_Results)
|
||||
a_fs_Results->collectionNumber, a_fs_Results->connP->hostName,
|
||||
a_fs_Results->probeNum, printableTime);
|
||||
|
||||
Print_fs_OverallPerfInfo(&(fullPerfP->overall));
|
||||
Print_fs_DetailedPerfInfo(&(fullPerfP->det));
|
||||
numLongs = a_fs_Results->data.AFS_CollData_len;
|
||||
if (numLongs != fullPerfLongs) {
|
||||
fprintf(fs_outFD,
|
||||
" ** Data size mismatch in full performance collection!\n");
|
||||
fprintf(fs_outFD, " ** Expecting %d, got %d\n", fullPerfLongs,
|
||||
numLongs);
|
||||
|
||||
/* Unfortunately, the full perf stats contain timeval structures which
|
||||
* do not have the same size everywhere. At least try to print
|
||||
* the overall stats.
|
||||
*/
|
||||
if (numLongs >= (sizeof(struct afs_stats_CMPerf) / sizeof(afs_int32))) {
|
||||
Print_fs_OverallPerfInfo(&(fullPerfP->overall));
|
||||
}
|
||||
} else {
|
||||
Print_fs_OverallPerfInfo(&(fullPerfP->overall));
|
||||
Print_fs_DetailedPerfInfo(&(fullPerfP->det));
|
||||
}
|
||||
|
||||
} /*Print_fs_FullPerfInfo */
|
||||
|
||||
|
@ -1808,6 +1808,7 @@ fs_Results_ltoa(struct fs_Display_Data *a_fsData, /* target buffer */
|
||||
int idx;
|
||||
int i, j;
|
||||
afs_int32 *tmpbuf;
|
||||
afs_int32 numInt32s;
|
||||
|
||||
if (afsmon_debug) {
|
||||
fprintf(debugFD, "[ %s ] Called, a_fsData= %p, a_fsResults= %p\n", rn,
|
||||
@ -1823,6 +1824,25 @@ fs_Results_ltoa(struct fs_Display_Data *a_fsData, /* target buffer */
|
||||
* - fullPerfP->det which gives detailed info about file server operation
|
||||
* execution times */
|
||||
|
||||
/*
|
||||
* Unfortunately, the full perf stats contain timeval structures which
|
||||
* do not have the same size everywhere. Avoid displaying gargbage,
|
||||
* but at least try to show the overall stats.
|
||||
*/
|
||||
numInt32s = a_fsResults->data.AFS_CollData_len;
|
||||
if (numInt32s !=
|
||||
(sizeof(struct fs_stats_FullPerfStats) / sizeof(afs_int32))) {
|
||||
srcbuf = a_fsResults->data.AFS_CollData_val;
|
||||
for (i = 0; i < NUM_FS_STAT_ENTRIES; i++) {
|
||||
if (i < numInt32s && i < NUM_XSTAT_FS_AFS_PERFSTATS_LONGS) {
|
||||
sprintf(a_fsData->data[i], "%d", srcbuf[i]);
|
||||
} else {
|
||||
sprintf(a_fsData->data[i], "%s", "--");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* copy overall performance statistics */
|
||||
srcbuf = (afs_int32 *) & (fullPerfP->overall);
|
||||
idx = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user