From 9ee3d8dc6e0713ef4ed056fd617bfcaed3065cae Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sat, 30 Jan 2021 16:45:37 +0100 Subject: [PATCH] Small code optimization Signed-off-by: Sebastien GODARD --- sadf.c | 6 +++--- sar.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sadf.c b/sadf.c index 025d44f..4982197 100644 --- a/sadf.c +++ b/sadf.c @@ -681,9 +681,6 @@ int generic_write_stats(int curr, int use_tm_start, int use_tm_end, int reset, cross_day = TRUE; } - /* Get interval values in 1/100th of a second */ - get_itv_value(&record_hdr[curr], &record_hdr[!curr], &itv); - /* Check time (2) */ if (use_tm_end && (datecmp(rectime, &tm_end, cross_day) > 0)) { /* End time exceeded */ @@ -691,6 +688,9 @@ int generic_write_stats(int curr, int use_tm_start, int use_tm_end, int reset, return 0; } + /* Get interval values in 1/100th of a second */ + get_itv_value(&record_hdr[curr], &record_hdr[!curr], &itv); + dt = itv / 100; /* Correct rounding error for dt */ if ((itv % 100) >= 50) { diff --git a/sar.c b/sar.c index 97be5db..490016b 100644 --- a/sar.c +++ b/sar.c @@ -486,9 +486,6 @@ int write_stats(int curr, int read_from_file, long *cnt, int use_tm_start, cross_day = TRUE; } - /* Get interval value in 1/100th of a second */ - get_itv_value(&record_hdr[curr], &record_hdr[!curr], &itv); - /* Check time (2) */ if (use_tm_end && (datecmp(&rectime, &tm_end, cross_day) > 0)) { /* End time exceeded */ @@ -496,6 +493,9 @@ int write_stats(int curr, int read_from_file, long *cnt, int use_tm_start, return 0; } + /* Get interval value in 1/100th of a second */ + get_itv_value(&record_hdr[curr], &record_hdr[!curr], &itv); + avg_count++; /* Test stdout */ -- 2.40.0