mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
ziomon/ziorep_utilization: add pchid column to physical adapter report
In ziorep_utilization tool physical adapter report represents PCHID scope, rather than CHPID. PCHID column is added as a very first column of physical adapter report for non-CSV format report. Old version of physical adapter report with CHPID column only looks like: ... CHP|adapter in %-|--bus in %---|--cpu in %---| ID min max avg min max avg min max avg 2020-05-14 14:00:41 60 0 0 0.0 1 1 1.0 0 0 0.0 61 0 0 0.0 1 1 1.0 0 0 0.0 ... New version of physical adapter report with additional PCHID column looks like: ... PCH |CHP|adapter in %-|--bus in %---|--cpu in %---| ID ID min max avg min max avg min max avg 2020-05-14 14:00:41 01c0 60 0 0 0.0 1 1 1.0 0 0 0.0 01c1 61 0 0 0.0 1 1 1.0 0 0 0.0 ... For CSV-format report PCHID column is appended to the end of each record line. For older kernel releases, where PCHID sysfs entry is not available, replace PCHID column value with "n/a". Signed-off-by: Fedor Loshakov <loshakov@linux.ibm.com> Reviewed-by: Benjamin Block <bblock@linux.ibm.com> Reviewed-by: Sakshi Singh <005c7w@linux.ibm.com> Reviewed-by: M Nikhil <nikh1092@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
f340a96fdf
commit
cf7060ea08
@@ -309,6 +309,22 @@ void PhysAdapterPrinter::print_phys_adpt(FILE *fp, __u32 host_id, int *rc)
|
||||
fprintf(fp, "%3x", chpid);
|
||||
}
|
||||
|
||||
void PhysAdapterPrinter::print_pchid(FILE *fp, __u32 host_id, int *rc)
|
||||
{
|
||||
__u32 pchid = m_cfg->get_pchid_by_host_id(host_id, rc);
|
||||
|
||||
if (m_csv)
|
||||
if (pchid != ZIOREP_PCHID_NA)
|
||||
fprintf(fp, "%x", pchid);
|
||||
else
|
||||
fprintf(fp, "%s", "n/a");
|
||||
else
|
||||
if (pchid != ZIOREP_PCHID_NA)
|
||||
fprintf(fp, "%04x", pchid);
|
||||
else
|
||||
fprintf(fp, "%s", "n/a ");
|
||||
}
|
||||
|
||||
|
||||
void PhysAdapterPrinter::print_utilization(FILE *fp,
|
||||
const struct abbrev_stat *stat,
|
||||
@@ -361,10 +377,10 @@ void PhysAdapterPrinter::print_topline(FILE *fp)
|
||||
if (m_csv)
|
||||
fprintf(fp, "timestamp,aggregated,CHPID,adapter min %%,"
|
||||
"adapter max %%,adapter avg %%,bus min %%,bus max %%,"
|
||||
"bus avg %%,cpu min %%,cpu max %%,cpu avg %%\n");
|
||||
"bus avg %%,cpu min %%,cpu max %%,cpu avg %%,PCHID\n");
|
||||
else {
|
||||
fprintf(fp, "CHP|adapter in %%-|--bus in %%---|--cpu in %%---|\n");
|
||||
fprintf(fp, " ID min max avg min max avg min max avg\n");
|
||||
fprintf(fp, "PCH |CHP|adapter in %%-|--bus in %%---|--cpu in %%---|\n");
|
||||
fprintf(fp, " ID ID min max avg min max avg min max avg\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,6 +403,12 @@ int PhysAdapterPrinter::print_frame(FILE *fp,
|
||||
// print timestamp for every line in CSV mode
|
||||
timestamp_printed = true;
|
||||
}
|
||||
if (!m_csv) {
|
||||
print_pchid(fp, *i, &lrc);
|
||||
if (lrc)
|
||||
return -1;
|
||||
print_delimiter(fp);
|
||||
}
|
||||
print_phys_adpt(fp, *i, &lrc);
|
||||
if (lrc)
|
||||
return -1;
|
||||
@@ -402,6 +424,12 @@ int PhysAdapterPrinter::print_frame(FILE *fp,
|
||||
print_utilization(fp, &util->stats.cpu,
|
||||
util->stats.count,
|
||||
util->valid);
|
||||
if (m_csv) {
|
||||
print_delimiter(fp);
|
||||
print_pchid(fp, *i, &lrc);
|
||||
if (lrc)
|
||||
return -1;
|
||||
}
|
||||
fputc('\n', fp);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Utility classes to print framsets
|
||||
*
|
||||
* Copyright IBM Corp. 2008, 2021
|
||||
* Copyright IBM Corp. 2008, 2024
|
||||
*
|
||||
* s390-tools is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
@@ -108,6 +108,8 @@ public:
|
||||
private:
|
||||
void print_phys_adpt(FILE *fp, __u32 host_id,
|
||||
int *rc);
|
||||
void print_pchid(FILE *fp, __u32 host_id,
|
||||
int *rc);
|
||||
void print_utilization(FILE *fp, const struct abbrev_stat *stat,
|
||||
__u64 count, bool valid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user