[04/10] time_stats: add larger units

Message ID 170873668005.1860949.11612121203653366580.stgit@frogsfrogsfrogs
State New
Headers
Series [01/10] time_stats: report lifetime of the stats object |

Commit Message

Darrick J. Wong Feb. 24, 2024, 1:11 a.m. UTC
  From: Darrick J. Wong <djwong@kernel.org>

Filesystems can stay mounted for a very long time, so add some larger
units.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
---
 lib/time_stats.c |    3 +++
 1 file changed, 3 insertions(+)
  

Patch

diff --git a/lib/time_stats.c b/lib/time_stats.c
index 767b1a340e805..43106bda43a92 100644
--- a/lib/time_stats.c
+++ b/lib/time_stats.c
@@ -16,6 +16,9 @@  static const struct time_unit time_units[] = {
 	{ "s",		NSEC_PER_SEC	 },
 	{ "m",          (u64) NSEC_PER_SEC * 60},
 	{ "h",          (u64) NSEC_PER_SEC * 3600},
+	{ "d",          (u64) NSEC_PER_SEC * 3600 * 24},
+	{ "w",          (u64) NSEC_PER_SEC * 3600 * 24 * 7},
+	{ "y",          (u64) NSEC_PER_SEC * ((3600 * 24 * 7 * 365) + (3600 * (24 / 4) * 7))}, /* 365.25d */
 	{ "eon",        U64_MAX          },
 };