From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Lei Feng <flei@whamcloud.com>,
Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 09/42] lustre: ldebugfs: make job_stats and rename_stats valid YAML
Date: Mon, 23 Jan 2023 18:00:22 -0500 [thread overview]
Message-ID: <1674514855-15399-10-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1674514855-15399-1-git-send-email-jsimmons@infradead.org>
From: Lei Feng <flei@whamcloud.com>
Adjust the format of job_stats and rename_stats to make
them valid YAML. This fixes the output to correctly indent
the items to follow YAML formatting rules.
Add a test case to verify the format of these params is valid
YAML to avoid other errors being introduced in the future.
WC-bug-id: https://jira.whamcloud.com/browse/LU-16110
Lustre-commit: e96cb6ff1fea7a2bc ("LU-16110 lprocfs: make job_stats and rename_stats valid YAML")
Signed-off-by: Lei Feng <flei@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48417
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
fs/lustre/include/lprocfs_status.h | 2 +-
fs/lustre/llite/lproc_llite.c | 8 ++++---
fs/lustre/mdc/lproc_mdc.c | 3 ++-
fs/lustre/obdclass/genops.c | 2 +-
fs/lustre/obdclass/lprocfs_status.c | 36 ++++++++++++++++++++++-------
fs/lustre/osc/lproc_osc.c | 6 +++--
6 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/fs/lustre/include/lprocfs_status.h b/fs/lustre/include/lprocfs_status.h
index f53125c96683..ef923ae4ca37 100644
--- a/fs/lustre/include/lprocfs_status.h
+++ b/fs/lustre/include/lprocfs_status.h
@@ -461,7 +461,7 @@ int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only);
int lprocfs_obd_cleanup(struct obd_device *obd);
void lprocfs_stats_header(struct seq_file *seq, ktime_t now,
ktime_t ts_init, int width, const char *colon,
- bool show_units);
+ bool show_units, const char *prefix);
/* Generic callbacks */
int ldebugfs_uint(struct seq_file *m, void *data);
diff --git a/fs/lustre/llite/lproc_llite.c b/fs/lustre/llite/lproc_llite.c
index a57d7bb0a848..ef7ca4c67681 100644
--- a/fs/lustre/llite/lproc_llite.c
+++ b/fs/lustre/llite/lproc_llite.c
@@ -2020,7 +2020,8 @@ static int ll_rw_extents_stats_pp_seq_show(struct seq_file *seq, void *v)
}
spin_lock(&sbi->ll_pp_extent_lock);
- lprocfs_stats_header(seq, ktime_get(), rw_extents->pp_init, 25, ":", 1);
+ lprocfs_stats_header(seq, ktime_get(), rw_extents->pp_init, 25, ":",
+ true, "");
seq_printf(seq, "%15s %19s | %20s\n", " ", "read", "write");
seq_printf(seq, "%13s %14s %4s %4s | %14s %4s %4s\n",
"extents", "calls", "%", "cum%", "calls", "%", "cum%");
@@ -2157,7 +2158,8 @@ static int ll_rw_extents_stats_seq_show(struct seq_file *seq, void *v)
}
spin_lock(&sbi->ll_lock);
- lprocfs_stats_header(seq, ktime_get(), rw_extents->pp_init, 25, ":", 1);
+ lprocfs_stats_header(seq, ktime_get(), rw_extents->pp_init, 25, ":",
+ true, "");
seq_printf(seq, "%15s %19s | %20s\n", " ", "read", "write");
seq_printf(seq, "%13s %14s %4s %4s | %14s %4s %4s\n",
@@ -2341,7 +2343,7 @@ static int ll_rw_offset_stats_seq_show(struct seq_file *seq, void *v)
}
spin_lock(&sbi->ll_process_lock);
lprocfs_stats_header(seq, ktime_get(), sbi->ll_process_stats_init, 25,
- ":", true);
+ ":", true, "");
seq_printf(seq, "%3s %10s %14s %14s %17s %17s %14s\n",
"R/W", "PID", "RANGE START", "RANGE END",
"SMALLEST EXTENT", "LARGEST EXTENT", "OFFSET");
diff --git a/fs/lustre/mdc/lproc_mdc.c b/fs/lustre/mdc/lproc_mdc.c
index cb3744ad9f93..81397a388681 100644
--- a/fs/lustre/mdc/lproc_mdc.c
+++ b/fs/lustre/mdc/lproc_mdc.c
@@ -513,7 +513,8 @@ static int mdc_stats_seq_show(struct seq_file *seq, void *v)
struct obd_device *obd = seq->private;
struct osc_stats *stats = &obd2osc_dev(obd)->od_stats;
- lprocfs_stats_header(seq, ktime_get(), stats->os_init, 25, ":", true);
+ lprocfs_stats_header(seq, ktime_get(), stats->os_init, 25, ":", true,
+ "");
seq_printf(seq, "lockless_write_bytes\t\t%llu\n",
stats->os_lockless_writes);
seq_printf(seq, "lockless_read_bytes\t\t%llu\n",
diff --git a/fs/lustre/obdclass/genops.c b/fs/lustre/obdclass/genops.c
index 6e4d2402efee..a20b119f9c37 100644
--- a/fs/lustre/obdclass/genops.c
+++ b/fs/lustre/obdclass/genops.c
@@ -1448,7 +1448,7 @@ int obd_mod_rpc_stats_seq_show(struct client_obd *cli, struct seq_file *seq)
spin_lock_irq(&cli->cl_mod_rpcs_waitq.lock);
lprocfs_stats_header(seq, ktime_get(), cli->cl_mod_rpcs_init, 25,
- ":", true);
+ ":", true, "");
seq_printf(seq, "modify_RPCs_in_flight: %hu\n",
cli->cl_mod_rpcs_in_flight);
diff --git a/fs/lustre/obdclass/lprocfs_status.c b/fs/lustre/obdclass/lprocfs_status.c
index 01b8132087d6..edc576d5f957 100644
--- a/fs/lustre/obdclass/lprocfs_status.c
+++ b/fs/lustre/obdclass/lprocfs_status.c
@@ -1373,21 +1373,40 @@ static void *lprocfs_stats_seq_next(struct seq_file *p, void *v, loff_t *pos)
return lprocfs_stats_seq_start(p, pos);
}
+/**
+ * print header of stats including snapshot_time, start_time and elapsed_time.
+ *
+ * @seq the file to print content to
+ * @now end time to calculate elapsed_time
+ * @ts_init start time to calculate elapsed_time
+ * @width the width of key to align them well
+ * @colon "" or ":"
+ * @show_units show units or not
+ * @prefix prefix (indent) before printing each line of header
+ * to align them with other content
+ */
void lprocfs_stats_header(struct seq_file *seq, ktime_t now, ktime_t ts_init,
- int width, const char *colon, bool show_units)
+ int width, const char *colon, bool show_units,
+ const char *prefix)
{
const char *units = show_units ? " secs.nsecs" : "";
struct timespec64 ts;
+ const char *field;
+ field = (colon && colon[0]) ? "snapshot_time:" : "snapshot_time";
ts = ktime_to_timespec64(now);
- seq_printf(seq, "%-*s%s %llu.%09lu%s\n", width,
- "snapshot_time", colon, (s64)ts.tv_sec, ts.tv_nsec, units);
+ seq_printf(seq, "%s%-*s %llu.%09lu%s\n", prefix, width, field,
+ (s64)ts.tv_sec, ts.tv_nsec, units);
+
+ field = (colon && colon[0]) ? "start_time:" : "start_time";
ts = ktime_to_timespec64(ts_init);
- seq_printf(seq, "%-*s%s %llu.%09lu%s\n", width,
- "start_time", colon, (s64)ts.tv_sec, ts.tv_nsec, units);
+ seq_printf(seq, "%s%-*s %llu.%09lu%s\n", prefix, width, field,
+ (s64)ts.tv_sec, ts.tv_nsec, units);
+
+ field = (colon && colon[0]) ? "elapsed_time:" : "elapsed_time";
ts = ktime_to_timespec64(ktime_sub(now, ts_init));
- seq_printf(seq, "%-*s%s %llu.%09lu%s\n", width,
- "elapsed_time", colon, (s64)ts.tv_sec, ts.tv_nsec, units);
+ seq_printf(seq, "%s%-*s %llu.%09lu%s\n", prefix, width, field,
+ (s64)ts.tv_sec, ts.tv_nsec, units);
}
EXPORT_SYMBOL(lprocfs_stats_header);
@@ -1400,7 +1419,8 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v)
int idx = *(loff_t *)v;
if (idx == 0)
- lprocfs_stats_header(p, ktime_get(), stats->ls_init, 25, "", 1);
+ lprocfs_stats_header(p, ktime_get(), stats->ls_init, 25, "",
+ true, "");
hdr = &stats->ls_cnt_header[idx];
lprocfs_stats_collect(stats, idx, &ctr);
diff --git a/fs/lustre/osc/lproc_osc.c b/fs/lustre/osc/lproc_osc.c
index 54b86d17eb78..c4b1e3e4e2cc 100644
--- a/fs/lustre/osc/lproc_osc.c
+++ b/fs/lustre/osc/lproc_osc.c
@@ -702,7 +702,8 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
spin_lock(&cli->cl_loi_list_lock);
- lprocfs_stats_header(seq, ktime_get(), cli->cl_stats_init, 25, ":", 1);
+ lprocfs_stats_header(seq, ktime_get(), cli->cl_stats_init, 25, ":",
+ true, "");
seq_printf(seq, "read RPCs in flight: %d\n",
cli->cl_r_in_flight);
seq_printf(seq, "write RPCs in flight: %d\n",
@@ -814,7 +815,8 @@ static int osc_stats_seq_show(struct seq_file *seq, void *v)
struct obd_device *obd = seq->private;
struct osc_stats *stats = &obd2osc_dev(obd)->od_stats;
- lprocfs_stats_header(seq, ktime_get(), stats->os_init, 25, ":", true);
+ lprocfs_stats_header(seq, ktime_get(), stats->os_init, 25, ":", true,
+ "");
seq_printf(seq, "lockless_write_bytes\t\t%llu\n",
stats->os_lockless_writes);
seq_printf(seq, "lockless_read_bytes\t\t%llu\n",
--
2.27.0
_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
next prev parent reply other threads:[~2023-01-23 23:11 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-23 23:00 [lustre-devel] [PATCH 00/42] lustre: sync to OpenSFS tree as of Jan 22 2023 James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 01/42] lustre: osc: pack osc_async_page better James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 02/42] lnet: lnet_peer_merge_data to understand large addr James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 03/42] lnet: router_discover - handle large addrs in ping James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 04/42] lnet: Drop LNet message if deadline exceeded James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 05/42] lnet: change lnet_find_best_lpni to handle large NIDs James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 06/42] lustre: ldebugfs: add histogram to stats counter James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 07/42] lustre: llite: wake_up after cl_object_kill James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 08/42] lustre: pcc: use two bits to indicate pcc type for attach James Simmons
2023-01-23 23:00 ` James Simmons [this message]
2023-01-23 23:00 ` [lustre-devel] [PATCH 10/42] lustre: misc: fix stats snapshot_time to use wallclock James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 11/42] lustre: pools: force creation of a component without a pool James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 12/42] lustre: sec: reserve flag for fid2path for encrypted files James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 13/42] lustre: llite: update statx size/ctime for fallocate James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 14/42] lustre: ptlrpc: fiemap flexible array James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 15/42] lustre: ptlrpc: Add LCME_FL_PARITY to wirecheck James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 16/42] lnet: selftest: lst read-outside of allocation James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 17/42] lustre: misc: rename lprocfs_stats functions James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 18/42] lustre: osc: Fix possible null pointer James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 19/42] lustre: ptlrpc: NUL terminate long jobid strings James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 20/42] lustre: uapi: remove _GNU_SOURCE dependency in lustre_user.h James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 21/42] lnet: handles unregister/register events James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 22/42] lustre: update version to 2.15.53 James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 23/42] lustre: ptlrpc: don't panic during reconnection James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 24/42] lustre: move to kobj_type default_groups James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 25/42] lnet: increase transaction timeout James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 26/42] lnet: Allow IP specification James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 27/42] lustre: obdclass: fix T10PI prototypes James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 28/42] lustre: obdclass: prefer T10 checksum if the target supports it James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 29/42] lustre: llite: remove false outdated comment James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 30/42] lnet: socklnd: clarify error message on timeout James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 31/42] lustre: llite: replace selinux_is_enabled() James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 32/42] lustre: enc: S_ENCRYPTED flag on OST objects for enc files James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 33/42] lnet: asym route inconsistency warning James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 34/42] lnet: o2iblnd: reset hiw proportionally James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 35/42] lnet: libcfs: cfs_hash_for_each_empty optimization James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 36/42] lustre: llite: always enable remote subdir mount James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 37/42] lnet: selftest: migrate LNet selftest group handling to Netlink James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 38/42] lnet: use Netlink to support LNet ping commands James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 39/42] lustre: llite: revert: "llite: clear stale page's uptodate bit" James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 40/42] lnet: validate data sent from user land properly James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 41/42] lnet: modify lnet_inetdev to work with large NIDS James Simmons
2023-01-23 23:00 ` [lustre-devel] [PATCH 42/42] lustre: ldlm: remove obsolete LDLM_FL_SERVER_LOCK James Simmons
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1674514855-15399-10-git-send-email-jsimmons@infradead.org \
--to=jsimmons@infradead.org \
--cc=adilger@whamcloud.com \
--cc=flei@whamcloud.com \
--cc=green@whamcloud.com \
--cc=lustre-devel@lists.lustre.org \
--cc=neilb@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).