spdk_top: move store_last_run_counter() function
Moves store_last_run_counter() function to allow next patch to call it earlier in the code, inside get_data() function. Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com> Change-Id: I1e37080ec86309bbf33442fa12cbe9dc575cc864 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7950 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
39950bc8f9
commit
49bc3005f5
@ -592,6 +592,30 @@ sort_threads(const void *p1, const void *p2)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
store_last_run_counter(const char *poller_name, uint64_t thread_id, uint64_t last_run_counter)
|
||||
{
|
||||
struct run_counter_history *history;
|
||||
|
||||
TAILQ_FOREACH(history, &g_run_counter_history, link) {
|
||||
if (!strcmp(history->poller_name, poller_name) && history->thread_id == thread_id) {
|
||||
history->last_run_counter = last_run_counter;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
history = calloc(1, sizeof(*history));
|
||||
if (history == NULL) {
|
||||
fprintf(stderr, "Unable to allocate a history object in store_last_run_counter.\n");
|
||||
return;
|
||||
}
|
||||
history->poller_name = strdup(poller_name);
|
||||
history->thread_id = thread_id;
|
||||
history->last_run_counter = last_run_counter;
|
||||
|
||||
TAILQ_INSERT_TAIL(&g_run_counter_history, history, link);
|
||||
}
|
||||
|
||||
static int
|
||||
get_data(void)
|
||||
{
|
||||
@ -995,30 +1019,6 @@ get_last_run_counter(const char *poller_name, uint64_t thread_id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
store_last_run_counter(const char *poller_name, uint64_t thread_id, uint64_t last_run_counter)
|
||||
{
|
||||
struct run_counter_history *history;
|
||||
|
||||
TAILQ_FOREACH(history, &g_run_counter_history, link) {
|
||||
if (!strcmp(history->poller_name, poller_name) && history->thread_id == thread_id) {
|
||||
history->last_run_counter = last_run_counter;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
history = calloc(1, sizeof(*history));
|
||||
if (history == NULL) {
|
||||
fprintf(stderr, "Unable to allocate a history object in store_last_run_counter.\n");
|
||||
return;
|
||||
}
|
||||
history->poller_name = strdup(poller_name);
|
||||
history->thread_id = thread_id;
|
||||
history->last_run_counter = last_run_counter;
|
||||
|
||||
TAILQ_INSERT_TAIL(&g_run_counter_history, history, link);
|
||||
}
|
||||
|
||||
enum sort_type {
|
||||
BY_NAME,
|
||||
USE_GLOBAL,
|
||||
|
Loading…
Reference in New Issue
Block a user