Linux Perf
svghelper.c File Reference
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <linux/bitmap.h>
#include <linux/time64.h>
#include "perf.h"
#include "svghelper.h"
#include "util.h"
#include "cpumap.h"
Include dependency graph for svghelper.c:

Go to the source code of this file.

Classes

struct  cpumask_t
 
struct  topology
 

Macros

#define SLOT_MULT   30.0
 
#define SLOT_HEIGHT   25.0
 
#define SLOT_HALF   (SLOT_HEIGHT / 2)
 
#define MIN_TEXT_SIZE   0.01
 
#define cpumask_bits(maskp)   ((maskp)->bits)
 

Functions

static double cpu2slot (int cpu)
 
static double cpu2y (int cpu)
 
static double time2pixels (u64 __time)
 
static double round_text_size (double size)
 
void open_svg (const char *filename, int cpus, int rows, u64 start, u64 end)
 
static double normalize_height (double height)
 
void svg_ubox (int Yslot, u64 start, u64 end, double height, const char *type, int fd, int err, int merges)
 
void svg_lbox (int Yslot, u64 start, u64 end, double height, const char *type, int fd, int err, int merges)
 
void svg_fbox (int Yslot, u64 start, u64 end, double height, const char *type, int fd, int err, int merges)
 
void svg_box (int Yslot, u64 start, u64 end, const char *type)
 
static char * time_to_string (u64 duration)
 
void svg_blocked (int Yslot, int cpu, u64 start, u64 end, const char *backtrace)
 
void svg_running (int Yslot, int cpu, u64 start, u64 end, const char *backtrace)
 
void svg_waiting (int Yslot, int cpu, u64 start, u64 end, const char *backtrace)
 
static char * cpu_model (void)
 
void svg_cpu_box (int cpu, u64 __max_freq, u64 __turbo_freq)
 
void svg_process (int cpu, u64 start, u64 end, int pid, const char *name, const char *backtrace)
 
void svg_cstate (int cpu, u64 start, u64 end, int type)
 
static char * HzToHuman (unsigned long hz)
 
void svg_pstate (int cpu, u64 start, u64 end, u64 freq)
 
void svg_partial_wakeline (u64 start, int row1, char *desc1, int row2, char *desc2, const char *backtrace)
 
void svg_wakeline (u64 start, int row1, int row2, const char *backtrace)
 
void svg_interrupt (u64 start, int row, const char *backtrace)
 
void svg_text (int Yslot, u64 start, const char *text)
 
static void svg_legenda_box (int X, const char *text, const char *style)
 
void svg_io_legenda (void)
 
void svg_legenda (void)
 
void svg_time_grid (double min_thickness)
 
void svg_close (void)
 
static void scan_thread_topology (int *map, struct topology *t, int cpu, int *pos)
 
static void scan_core_topology (int *map, struct topology *t)
 
static int str_to_bitmap (char *s, cpumask_t *b)
 
int svg_build_topology_map (char *sib_core, int sib_core_nr, char *sib_thr, int sib_thr_nr)
 

Variables

static u64 first_time
 
static u64 last_time
 
static u64 turbo_frequency
 
static u64 max_freq
 
int svg_page_width = 1000
 
u64 svg_highlight
 
const char * svg_highlight_name
 
static u64 total_height
 
static FILE * svgfile
 
static int * topology_map
 

Macro Definition Documentation

◆ cpumask_bits

#define cpumask_bits (   maskp)    ((maskp)->bits)

Definition at line 691 of file svghelper.c.

◆ MIN_TEXT_SIZE

#define MIN_TEXT_SIZE   0.01

Definition at line 40 of file svghelper.c.

◆ SLOT_HALF

#define SLOT_HALF   (SLOT_HEIGHT / 2)

Definition at line 34 of file svghelper.c.

◆ SLOT_HEIGHT

#define SLOT_HEIGHT   25.0

Definition at line 33 of file svghelper.c.

◆ SLOT_MULT

#define SLOT_MULT   30.0

Definition at line 32 of file svghelper.c.

Function Documentation

◆ cpu2slot()

static double cpu2slot ( int  cpu)
static

Definition at line 45 of file svghelper.c.

◆ cpu2y()

static double cpu2y ( int  cpu)
static

Definition at line 52 of file svghelper.c.

Here is the call graph for this function:

◆ cpu_model()

static char* cpu_model ( void  )
static

Definition at line 325 of file svghelper.c.

◆ HzToHuman()

static char* HzToHuman ( unsigned long  hz)
static

Definition at line 451 of file svghelper.c.

Here is the call graph for this function:

◆ normalize_height()

static double normalize_height ( double  height)
static

Definition at line 143 of file svghelper.c.

◆ open_svg()

void open_svg ( const char *  filename,
int  cpus,
int  rows,
u64  start,
u64  end 
)

Definition at line 87 of file svghelper.c.

Here is the call graph for this function:

◆ round_text_size()

static double round_text_size ( double  size)
static

Definition at line 72 of file svghelper.c.

◆ scan_core_topology()

static void scan_core_topology ( int *  map,
struct topology t 
)
static

Definition at line 718 of file svghelper.c.

Here is the call graph for this function:

◆ scan_thread_topology()

static void scan_thread_topology ( int *  map,
struct topology t,
int  cpu,
int *  pos 
)
static

Definition at line 701 of file svghelper.c.

◆ str_to_bitmap()

static int str_to_bitmap ( char *  s,
cpumask_t b 
)
static

Definition at line 731 of file svghelper.c.

Here is the call graph for this function:

◆ svg_blocked()

void svg_blocked ( int  Yslot,
int  cpu,
u64  start,
u64  end,
const char *  backtrace 
)

Definition at line 222 of file svghelper.c.

Here is the call graph for this function:

◆ svg_box()

void svg_box ( int  Yslot,
u64  start,
u64  end,
const char *  type 
)

Definition at line 212 of file svghelper.c.

Here is the call graph for this function:

◆ svg_build_topology_map()

int svg_build_topology_map ( char *  sib_core,
int  sib_core_nr,
char *  sib_thr,
int  sib_thr_nr 
)

Definition at line 757 of file svghelper.c.

Here is the call graph for this function:

◆ svg_close()

void svg_close ( void  )

Definition at line 682 of file svghelper.c.

◆ svg_cpu_box()

void svg_cpu_box ( int  cpu,
u64  __max_freq,
u64  __turbo_freq 
)

Definition at line 358 of file svghelper.c.

Here is the call graph for this function:

◆ svg_cstate()

void svg_cstate ( int  cpu,
u64  start,
u64  end,
int  type 
)

Definition at line 418 of file svghelper.c.

Here is the call graph for this function:

◆ svg_fbox()

void svg_fbox ( int  Yslot,
u64  start,
u64  end,
double  height,
const char *  type,
int  fd,
int  err,
int  merges 
)

Definition at line 193 of file svghelper.c.

Here is the call graph for this function:

◆ svg_interrupt()

void svg_interrupt ( u64  start,
int  row,
const char *  backtrace 
)

Definition at line 583 of file svghelper.c.

Here is the call graph for this function:

◆ svg_io_legenda()

void svg_io_legenda ( void  )

Definition at line 623 of file svghelper.c.

Here is the call graph for this function:

◆ svg_lbox()

void svg_lbox ( int  Yslot,
u64  start,
u64  end,
double  height,
const char *  type,
int  fd,
int  err,
int  merges 
)

Definition at line 174 of file svghelper.c.

Here is the call graph for this function:

◆ svg_legenda()

void svg_legenda ( void  )

Definition at line 637 of file svghelper.c.

Here is the call graph for this function:

◆ svg_legenda_box()

static void svg_legenda_box ( int  X,
const char *  text,
const char *  style 
)
static

Definition at line 612 of file svghelper.c.

◆ svg_partial_wakeline()

void svg_partial_wakeline ( u64  start,
int  row1,
char *  desc1,
int  row2,
char *  desc2,
const char *  backtrace 
)

Definition at line 496 of file svghelper.c.

Here is the call graph for this function:

◆ svg_process()

void svg_process ( int  cpu,
u64  start,
u64  end,
int  pid,
const char *  name,
const char *  backtrace 
)

Definition at line 384 of file svghelper.c.

Here is the call graph for this function:

◆ svg_pstate()

void svg_pstate ( int  cpu,
u64  start,
u64  end,
u64  freq 
)

Definition at line 475 of file svghelper.c.

Here is the call graph for this function:

◆ svg_running()

void svg_running ( int  Yslot,
int  cpu,
u64  start,
u64  end,
const char *  backtrace 
)

Definition at line 236 of file svghelper.c.

Here is the call graph for this function:

◆ svg_text()

void svg_text ( int  Yslot,
u64  start,
const char *  text 
)

Definition at line 603 of file svghelper.c.

Here is the call graph for this function:

◆ svg_time_grid()

void svg_time_grid ( double  min_thickness)

Definition at line 653 of file svghelper.c.

Here is the call graph for this function:

◆ svg_ubox()

void svg_ubox ( int  Yslot,
u64  start,
u64  end,
double  height,
const char *  type,
int  fd,
int  err,
int  merges 
)

Definition at line 155 of file svghelper.c.

Here is the call graph for this function:

◆ svg_waiting()

void svg_waiting ( int  Yslot,
int  cpu,
u64  start,
u64  end,
const char *  backtrace 
)

Definition at line 290 of file svghelper.c.

Here is the call graph for this function:

◆ svg_wakeline()

void svg_wakeline ( u64  start,
int  row1,
int  row2,
const char *  backtrace 
)

Definition at line 554 of file svghelper.c.

Here is the call graph for this function:

◆ time2pixels()

static double time2pixels ( u64  __time)
static

Definition at line 60 of file svghelper.c.

◆ time_to_string()

static char * time_to_string ( u64  duration)
static

Definition at line 272 of file svghelper.c.

Variable Documentation

◆ first_time

u64 first_time
static

Definition at line 28 of file svghelper.c.

◆ last_time

u64 last_time
static

Definition at line 28 of file svghelper.c.

◆ max_freq

u64 max_freq
static

Definition at line 29 of file svghelper.c.

◆ svg_highlight

u64 svg_highlight

Definition at line 37 of file svghelper.c.

◆ svg_highlight_name

const char* svg_highlight_name

Definition at line 38 of file svghelper.c.

◆ svg_page_width

int svg_page_width = 1000

Definition at line 36 of file svghelper.c.

◆ svgfile

FILE* svgfile
static

Definition at line 43 of file svghelper.c.

◆ topology_map

int* topology_map
static

Definition at line 50 of file svghelper.c.

◆ total_height

u64 total_height
static

Definition at line 42 of file svghelper.c.

◆ turbo_frequency

u64 turbo_frequency
static

Definition at line 29 of file svghelper.c.