summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2019-06-08 16:25:29 +0200
committerRichard Braun <rbraun@sceen.net>2019-06-08 16:25:29 +0200
commit6873ec9b5baf68e94845e483af70903dae4cff6a (patch)
treeb1e708fafa3ffff193c034b83fa4a4623d22c771
parent251129e618233c60c23a098cdd2b6b6e504c5436 (diff)
kern/sref: track epoch durations
-rw-r--r--kern/sref.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kern/sref.c b/kern/sref.c
index 1f306e60..65fc3964 100644
--- a/kern/sref.c
+++ b/kern/sref.c
@@ -126,10 +126,13 @@ struct sref_data {
alignas(CPU_L1_SIZE) unsigned int nr_pending_acks;
};
+ uint64_t start_ts;
struct syscnt sc_epochs;
struct syscnt sc_dirty_zeroes;
struct syscnt sc_true_zeroes;
struct syscnt sc_revives;
+ struct syscnt sc_last_epoch_ms;
+ struct syscnt sc_longest_epoch_ms;
};
/*
@@ -214,10 +217,20 @@ sref_data_check_epoch_id(const struct sref_data *data, unsigned int epoch_id)
static void
sref_data_start_epoch(struct sref_data *data)
{
+ uint64_t now, duration;
unsigned int epoch_id;
+ now = clock_get_time();
+ duration = clock_ticks_to_ms(now - data->start_ts);
+ syscnt_set(&data->sc_last_epoch_ms, duration);
+
+ if (duration > syscnt_read(&data->sc_longest_epoch_ms)) {
+ syscnt_set(&data->sc_longest_epoch_ms, duration);
+ }
+
assert(data->nr_pending_acks == 0);
data->nr_pending_acks = cpu_count();
+ data->start_ts = now;
epoch_id = atomic_load(&data->epoch_id, ATOMIC_RELAXED);
atomic_store(&data->epoch_id, epoch_id + 1, ATOMIC_RELEASE);
@@ -917,11 +930,14 @@ sref_data_init(struct sref_data *data)
{
data->epoch_id = SREF_EPOCH_ID_INIT_VALUE;
data->nr_pending_acks = 0;
+ data->start_ts = clock_get_time();
syscnt_register(&data->sc_epochs, "sref_epochs");
syscnt_register(&data->sc_dirty_zeroes, "sref_dirty_zeroes");
syscnt_register(&data->sc_true_zeroes, "sref_true_zeroes");
syscnt_register(&data->sc_revives, "sref_revives");
+ syscnt_register(&data->sc_last_epoch_ms, "sref_last_epoch_ms");
+ syscnt_register(&data->sc_longest_epoch_ms, "sref_longest_epoch_ms");
}
static int __init