Re: [PATCH v2 1/3] perf: add cpu__max_present_cpu()

From: Jiri Olsa
Date: Tue Feb 14 2017 - 06:18:41 EST


On Mon, Feb 13, 2017 at 04:34:34PM +0100, Jan Stancek wrote:
> Similar to cpu__max_cpu() (which returns max possible CPU),
> returns max present CPU.
>
> Signed-off-by: Jan Stancek <jstancek@xxxxxxxxxx>
> ---
> tools/perf/util/cpumap.c | 22 ++++++++++++++++++++++
> tools/perf/util/cpumap.h | 1 +
> 2 files changed, 23 insertions(+)
>
> diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
> index 2c0b52264a46..8c7504939113 100644
> --- a/tools/perf/util/cpumap.c
> +++ b/tools/perf/util/cpumap.c
> @@ -9,6 +9,7 @@
> #include "asm/bug.h"
>
> static int max_cpu_num;
> +static int max_present_cpu_num;

I think it'd be less confusing for me if we follow the kernel names here

static int max_cpu_possible;
static int max_cpu_present;

also I wonder we should use

static int max_cpu_online;

instead of:

sysconf(_SC_NPROCESSORS_ONLN)

but we can do it all later on as follow up

jirka