Linux Perf
cpumap.c File Reference
#include "util.h"
#include <api/fs/fs.h>
#include "../perf.h"
#include "cpumap.h"
#include <assert.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <linux/bitmap.h>
#include "asm/bug.h"
#include "sane_ctype.h"
Include dependency graph for cpumap.c:

Go to the source code of this file.

Macros

#define BUFSIZE   1024
 
#define COMMA   first ? "" : ","
 

Functions

static struct cpu_mapcpu_map__default_new (void)
 
static struct cpu_mapcpu_map__trim_new (int nr_cpus, int *tmp_cpus)
 
struct cpu_mapcpu_map__read (FILE *file)
 
static struct cpu_mapcpu_map__read_all_cpu_map (void)
 
struct cpu_mapcpu_map__new (const char *cpu_list)
 
static struct cpu_mapcpu_map__from_entries (struct cpu_map_entries *cpus)
 
static struct cpu_mapcpu_map__from_mask (struct cpu_map_mask *mask)
 
struct cpu_mapcpu_map__new_data (struct cpu_map_data *data)
 
size_t cpu_map__fprintf (struct cpu_map *map, FILE *fp)
 
struct cpu_mapcpu_map__dummy_new (void)
 
struct cpu_mapcpu_map__empty_new (int nr)
 
static void cpu_map__delete (struct cpu_map *map)
 
struct cpu_mapcpu_map__get (struct cpu_map *map)
 
void cpu_map__put (struct cpu_map *map)
 
static int cpu__get_topology_int (int cpu, const char *name, int *value)
 
int cpu_map__get_socket_id (int cpu)
 
int cpu_map__get_socket (struct cpu_map *map, int idx, void *data __maybe_unused)
 
static int cmp_ids (const void *a, const void *b)
 
int cpu_map__build_map (struct cpu_map *cpus, struct cpu_map **res, int(*f)(struct cpu_map *map, int cpu, void *data), void *data)
 
int cpu_map__get_core_id (int cpu)
 
int cpu_map__get_core (struct cpu_map *map, int idx, void *data)
 
int cpu_map__build_socket_map (struct cpu_map *cpus, struct cpu_map **sockp)
 
int cpu_map__build_core_map (struct cpu_map *cpus, struct cpu_map **corep)
 
static int get_max_num (char *path, int *max)
 
static void set_max_cpu_num (void)
 
static void set_max_node_num (void)
 
int cpu__max_node (void)
 
int cpu__max_cpu (void)
 
int cpu__max_present_cpu (void)
 
int cpu__get_node (int cpu)
 
static int init_cpunode_map (void)
 
int cpu__setup_cpunode_map (void)
 
bool cpu_map__has (struct cpu_map *cpus, int cpu)
 
int cpu_map__idx (struct cpu_map *cpus, int cpu)
 
int cpu_map__cpu (struct cpu_map *cpus, int idx)
 
size_t cpu_map__snprint (struct cpu_map *map, char *buf, size_t size)
 
static char hex_char (unsigned char val)
 
size_t cpu_map__snprint_mask (struct cpu_map *map, char *buf, size_t size)
 

Variables

static int max_cpu_num
 
static int max_present_cpu_num
 
static int max_node_num
 
static int * cpunode_map
 

Macro Definition Documentation

◆ BUFSIZE

#define BUFSIZE   1024

◆ COMMA

#define COMMA   first ? "" : ","

Function Documentation

◆ cmp_ids()

static int cmp_ids ( const void *  a,
const void *  b 
)
static

Definition at line 332 of file cpumap.c.

◆ cpu__get_node()

int cpu__get_node ( int  cpu)

Definition at line 534 of file cpumap.c.

◆ cpu__get_topology_int()

static int cpu__get_topology_int ( int  cpu,
const char *  name,
int *  value 
)
static

Definition at line 304 of file cpumap.c.

◆ cpu__max_cpu()

int cpu__max_cpu ( void  )

Definition at line 517 of file cpumap.c.

Here is the call graph for this function:

◆ cpu__max_node()

int cpu__max_node ( void  )

Definition at line 509 of file cpumap.c.

Here is the call graph for this function:

◆ cpu__max_present_cpu()

int cpu__max_present_cpu ( void  )

Definition at line 525 of file cpumap.c.

Here is the call graph for this function:

◆ cpu__setup_cpunode_map()

int cpu__setup_cpunode_map ( void  )

Definition at line 563 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__build_core_map()

int cpu_map__build_core_map ( struct cpu_map cpus,
struct cpu_map **  corep 
)

Definition at line 404 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__build_map()

int cpu_map__build_map ( struct cpu_map cpus,
struct cpu_map **  res,
int(*)(struct cpu_map *map, int cpu, void *data)  f,
void *  data 
)

Definition at line 337 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__build_socket_map()

int cpu_map__build_socket_map ( struct cpu_map cpus,
struct cpu_map **  sockp 
)

Definition at line 399 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__cpu()

int cpu_map__cpu ( struct cpu_map cpus,
int  idx 
)

Definition at line 633 of file cpumap.c.

◆ cpu_map__default_new()

static struct cpu_map* cpu_map__default_new ( void  )
static

Definition at line 20 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__delete()

static void cpu_map__delete ( struct cpu_map map)
static

Definition at line 282 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__dummy_new()

struct cpu_map* cpu_map__dummy_new ( void  )

Definition at line 252 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__empty_new()

struct cpu_map* cpu_map__empty_new ( int  nr)

Definition at line 265 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__fprintf()

size_t cpu_map__fprintf ( struct cpu_map map,
FILE *  fp 
)

Definition at line 242 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__from_entries()

static struct cpu_map* cpu_map__from_entries ( struct cpu_map_entries cpus)
static

Definition at line 192 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__from_mask()

static struct cpu_map* cpu_map__from_mask ( struct cpu_map_mask mask)
static

Definition at line 216 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__get()

struct cpu_map* cpu_map__get ( struct cpu_map map)

Definition at line 291 of file cpumap.c.

◆ cpu_map__get_core()

int cpu_map__get_core ( struct cpu_map map,
int  idx,
void *  data 
)

Definition at line 375 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__get_core_id()

int cpu_map__get_core_id ( int  cpu)

Definition at line 369 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__get_socket()

int cpu_map__get_socket ( struct cpu_map map,
int  idx,
void *data  __maybe_unused 
)

Definition at line 320 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__get_socket_id()

int cpu_map__get_socket_id ( int  cpu)

Definition at line 314 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__has()

bool cpu_map__has ( struct cpu_map cpus,
int  cpu 
)

Definition at line 616 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__idx()

int cpu_map__idx ( struct cpu_map cpus,
int  cpu 
)

Definition at line 621 of file cpumap.c.

◆ cpu_map__new()

struct cpu_map* cpu_map__new ( const char *  cpu_list)

Definition at line 125 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__new_data()

struct cpu_map* cpu_map__new_data ( struct cpu_map_data data)

Definition at line 234 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__put()

void cpu_map__put ( struct cpu_map map)

Definition at line 298 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__read()

struct cpu_map* cpu_map__read ( FILE *  file)

Definition at line 56 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__read_all_cpu_map()

static struct cpu_map* cpu_map__read_all_cpu_map ( void  )
static

Definition at line 111 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__snprint()

size_t cpu_map__snprint ( struct cpu_map map,
char *  buf,
size_t  size 
)

Definition at line 638 of file cpumap.c.

◆ cpu_map__snprint_mask()

size_t cpu_map__snprint_mask ( struct cpu_map map,
char *  buf,
size_t  size 
)

Definition at line 690 of file cpumap.c.

Here is the call graph for this function:

◆ cpu_map__trim_new()

static struct cpu_map* cpu_map__trim_new ( int  nr_cpus,
int *  tmp_cpus 
)
static

Definition at line 42 of file cpumap.c.

Here is the call graph for this function:

◆ get_max_num()

static int get_max_num ( char *  path,
int *  max 
)
static

Definition at line 410 of file cpumap.c.

Here is the call graph for this function:

◆ hex_char()

static char hex_char ( unsigned char  val)
static

Definition at line 681 of file cpumap.c.

◆ init_cpunode_map()

static int init_cpunode_map ( void  )
static

Definition at line 544 of file cpumap.c.

Here is the call graph for this function:

◆ set_max_cpu_num()

static void set_max_cpu_num ( void  )
static

Definition at line 442 of file cpumap.c.

Here is the call graph for this function:

◆ set_max_node_num()

static void set_max_node_num ( void  )
static

Definition at line 482 of file cpumap.c.

Here is the call graph for this function:

Variable Documentation

◆ cpunode_map

int* cpunode_map
static

Definition at line 18 of file cpumap.c.

◆ max_cpu_num

int max_cpu_num
static

Definition at line 15 of file cpumap.c.

◆ max_node_num

int max_node_num
static

Definition at line 17 of file cpumap.c.

◆ max_present_cpu_num

int max_present_cpu_num
static

Definition at line 16 of file cpumap.c.