mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 01:32:46 +07:00
2d7102a045
Change the include path so that progress.c can find cache.h since it was previously searching in the wrong directory. Committer notes: $ ls -la tools/perf/ui/../cache.h ls: cannot access 'tools/perf/ui/../cache.h': No such file or directory So it really should include ../../util/cache.h, or plain cache.h, since we have -Iutil in INC_FLAGS in tools/perf/Makefile.config Signed-off-by: Numfor Mbiziwo-Tiapo <nums@google.com> Cc: Jiri Olsa <jolsa@redhat.com>, Cc: Luke Mujica <lukemujica@google.com>, Cc: Stephane Eranian <eranian@google.com> To: Ian Rogers <irogers@google.com> Link: https://lkml.kernel.org/n/tip-pud8usyutvd2npg2vpsygncz@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
49 lines
947 B
C
49 lines
947 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/kernel.h>
|
|
#include "../util/cache.h"
|
|
#include "progress.h"
|
|
|
|
static void null_progress__update(struct ui_progress *p __maybe_unused)
|
|
{
|
|
}
|
|
|
|
static struct ui_progress_ops null_progress__ops =
|
|
{
|
|
.update = null_progress__update,
|
|
};
|
|
|
|
struct ui_progress_ops *ui_progress__ops = &null_progress__ops;
|
|
|
|
void ui_progress__update(struct ui_progress *p, u64 adv)
|
|
{
|
|
u64 last = p->curr;
|
|
|
|
p->curr += adv;
|
|
|
|
if (p->curr >= p->next) {
|
|
u64 nr = DIV_ROUND_UP(p->curr - last, p->step);
|
|
|
|
p->next += nr * p->step;
|
|
ui_progress__ops->update(p);
|
|
}
|
|
}
|
|
|
|
void __ui_progress__init(struct ui_progress *p, u64 total,
|
|
const char *title, bool size)
|
|
{
|
|
p->curr = 0;
|
|
p->next = p->step = total / 16 ?: 1;
|
|
p->total = total;
|
|
p->title = title;
|
|
p->size = size;
|
|
|
|
if (ui_progress__ops->init)
|
|
ui_progress__ops->init(p);
|
|
}
|
|
|
|
void ui_progress__finish(void)
|
|
{
|
|
if (ui_progress__ops->finish)
|
|
ui_progress__ops->finish();
|
|
}
|