perf_counter: tools: Define and use our own u64, s64 etc. definitions
PATCH 1/1 perf_counter: tools: Define and use our own u64, s64 etc. definitions
On 64-bit powerpc, __u64 is defined to be unsigned long rather than unsigned long long. This causes compiler warnings every time we print a __u64 value with %Lx.
Rather than changing __u64, we define our own u64 to be unsigned long long on all architectures, and similarly s64 as signed long long. For consistency we also define u32, s32, u16, s16, u8 and s8. These definitions are put in a new header, types.h, because these definitions are needed in util/string.h and util/symbol.h.
The main change here is the mechanical change of __[us]{64,32,16,8} to remove the "__". The other changes are:
* Create types.h
* Include types.h in perf.h, util/string.h and util/symbol.h
* Add types.h to the LIB_H definition in Makefile
* Added (u64) casts in process_overflow_event() and print_sym_table() to kill two remaining warnings.
--- tools/perf/Makefile | 1 + tools/perf/builtin-annotate.c | 66 ++++++++++++++++---------------- tools/perf/builtin-record.c | 20 +++++----- tools/perf/builtin-report.c | 80 ++++++++++++++++++++-------------------- tools/perf/builtin-stat.c | 62 +++++++++++++++--------------- tools/perf/builtin-top.c | 24 ++++++------ tools/perf/perf.h | 1 + tools/perf/types.h | 17 ++++++++ tools/perf/util/parse-events.c | 10 ++-- tools/perf/util/string.c | 2 +- tools/perf/util/string.h | 4 +- tools/perf/util/symbol.c | 20 +++++----- tools/perf/util/symbol.h | 15 ++++--- 13 files changed, 171 insertions(+), 151 deletions(-) create mode 100644 tools/perf/types.h
tools/perf/Makefile +1 -0
@@ -290,6 +290,7 @@ LIB_FILE=libperf.a LIB_H += ../../include/linux/perf_counter.h LIB_H += perf.h +LIB_H += types.h LIB_H += util/list.h LIB_H += util/rbtree.h LIB_H += util/levenshtein.h
tools/perf/builtin-annotate.c +33 -33
198 lines not on this page · raw message
tools/perf/builtin-record.c +10 -10
@@ -44,7 +44,7 @@ static long samples;static struct timeval last_read;static struct timeval this_read; -static __u64 bytes_written; +static u64 bytes_written;static struct pollfd event_array[MAX_NR_CPUS *MAX_COUNTERS ];
@@ -53,18 +53,18 @@ static int nr_cpu;struct mmap_event {struct perf_event_header header; -__u32 pid; -__u32 tid; -__u64 start; -__u64 len; -__u64 pgoff; +u32 pid; +u32 tid; +u64 start; +u64 len; +u64 pgoff;char filename[PATH_MAX ]; };struct comm_event {struct perf_event_header header; -__u32 pid; -__u32 tid; +u32 pid; +u32 tid;char comm[16 ]; };
@@ -240,7 +240,7 @@ static void pid_synthesize_comm_event(pid_t pid, int full) comm_ev.pid = pid; comm_ev.header.type =PERF_EVENT_COMM ; - size =ALIGN (size,sizeof (__u64)); + size =ALIGN (size,sizeof (u64)); comm_ev.header.size =sizeof (comm_ev) - (sizeof (comm_ev.comm) - size);if (!full) {
@@ -325,7 +325,7 @@ static void pid_synthesize_mmap_samples(pid_t pid) size =strlen (execname); execname[size -1 ] ='\0' ;/* Remove \n */ memcpy (mmap_ev.filename, execname, size); - size =ALIGN (size,sizeof (__u64)); + size =ALIGN (size,sizeof (u64)); mmap_ev.len -= mmap_ev.start; mmap_ev.header.size = (sizeof (mmap_ev) - (sizeof (mmap_ev.filename) - size));
tools/perf/builtin-report.c +40 -40
224 lines not on this page · raw message
tools/perf/builtin-stat.c +31 -31
138 lines not on this page · raw message
tools/perf/builtin-top.c +12 -12
@@ -54,7 +54,7 @@ static int system_wide = 0;static int default_interval =100000 ; -static __u64 count_filter =5 ; +static u64 count_filter =5 ;static int print_entries =15 ;static int target_pid =-1 ;
@@ -79,8 +79,8 @@ static int dump_symtab;* Symbols */ -static __u64 min_ip; -static __u64 max_ip =-1ll ; +static u64 min_ip; +static u64 max_ip =-1ll ;struct sym_entry {struct rb_node rb_node;
@@ -194,7 +194,7 @@ static void print_sym_table(void) 100.0 - (100.0*((samples_per_sec-ksamples_per_sec)/samples_per_sec)));if (nr_counters ==1 ) { -printf ("%Ld" , attrs[0 ].sample_period); +printf ("%Ld" , (u64 )attrs[0 ].sample_period);if (freq)printf ("Hz " );else
@@ -372,7 +372,7 @@ out_delete_dso:/* * Binary search in the histogram table and record the hit: */ -static void record_ip (__u64 ip,int counter) +static void record_ip (u64 ip,int counter) {struct symbol *sym =dso__find_symbol (kernel_dso, ip);
@@ -392,7 +392,7 @@ static void record_ip(__u64 ip, int counter) samples--; } -static void process_event (__u64 ip,int counter) +static void process_event (u64 ip,int counter) { samples++;
@@ -463,15 +463,15 @@ static void mmap_read_counter(struct mmap_data *md)for (; old != head;) {struct ip_event {struct perf_event_header header; -__u64 ip; -__u32 pid, target_pid; +u64 ip; +u32 pid, target_pid; };struct mmap_event {struct perf_event_header header; -__u32 pid, target_pid; -__u64 start; -__u64 len; -__u64 pgoff; +u32 pid, target_pid; +u64 start; +u64 len; +u64 pgoff;char filename[PATH_MAX ]; };
tools/perf/perf.h +1 -0
@@ -19,6 +19,7 @@#include <sys/syscall.h> #include "../../include/linux/perf_counter.h" +#include "types.h" /* * prctl(PR_TASK_PERF_COUNTERS_DISABLE) will (cheaply) disable all
tools/perf/types.h new file +17 -0
@@ -0,0 +1,17 @@ +#ifndef _PERF_TYPES_H +#define _PERF_TYPES_H + +/* +* We define u64 as unsigned long long for every architecture +* so that we can print it with %Lx without getting warnings. +*/ +typedef unsigned long long u64 ; +typedef signed long long s64 ; +typedef unsigned int u32 ; +typedef signed int s32 ; +typedef unsigned short u16 ; +typedef signed short s16 ; +typedef unsigned char u8 ; +typedef signed char s8 ; + +#endif /* _PERF_TYPES_H */
tools/perf/util/parse-events.c +5 -5
@@ -13,8 +13,8 @@ int nr_counters;struct perf_counter_attr attrs[MAX_COUNTERS ];struct event_symbol { -__u8 type; -__u64 config; +u8 type; +u64 config;char *symbol; };
@@ -96,7 +96,7 @@ static char *hw_cache_result [][MAX_ALIASES] = {char *event_name (int counter) { -__u64 config = attrs[counter].config; +u64 config = attrs[counter].config;int type = attrs[counter].type;static char buf[32 ];
@@ -112,7 +112,7 @@ char *event_name(int counter)return "unknown-hardware" ;case PERF_TYPE_HW_CACHE : { -__u8 cache_type, cache_op, cache_result; +u8 cache_type, cache_op, cache_result;static char name[100 ]; cache_type = (config >>0 ) &0xff ;
@@ -202,7 +202,7 @@ static int parse_generic_hw_symbols(const char *str, struct perf_counter_attr *a*/ static int parse_event_symbols (const char *str,struct perf_counter_attr *attr) { -__u64 config, id; +u64 config, id;int type;unsigned int i;const char *sep, *pstr;
tools/perf/util/string.c +1 -1
@@ -15,7 +15,7 @@ static int hex(char ch)* While we find nice hex chars, build a long_val. * Return number of chars processed. */ -int hex2u64 (const char *ptr,__u64 *long_val) +int hex2u64 (const char *ptr,u64 *long_val) {const char *p = ptr; *long_val =0 ;
tools/perf/util/string.h +2 -2
@@ -1,8 +1,8 @@#ifndef _PERF_STRING_H_#define _PERF_STRING_H_ -#include <linux/types.h> +#include "../types.h" -int hex2u64 (const char *ptr,__u64 *val); +int hex2u64 (const char *ptr,u64 *val);#endif
tools/perf/util/symbol.c +10 -10
@@ -9,9 +9,9 @@const char *sym_hist_filter; -static struct symbol *symbol__new (__u64 start,__u64 len, +static struct symbol *symbol__new (u64 start,u64 len,const char *name,unsigned int priv_size, -__u64 obj_start,int verbose) +u64 obj_start,int verbose) {size_t namelen =strlen (name) +1 ;struct symbol *self =calloc (1 , priv_size +sizeof (*self) + namelen);
@@ -21,14 +21,14 @@ static struct symbol *symbol__new(__u64 start, __u64 len,if (verbose >=2 )printf ("new symbol: %016Lx [%08lx]: %s, hist: %p, obj_start: %p\n" , - (__u64 )start, (unsigned long )len, name, self->hist, (void *)(unsigned long )obj_start); + (u64 )start, (unsigned long )len, name, self->hist, (void *)(unsigned long )obj_start); self->obj_start= obj_start; self->hist =NULL ; self->hist_sum =0 ;if (sym_hist_filter && !strcmp (name, sym_hist_filter)) - self->hist =calloc (sizeof (__u64), len); + self->hist =calloc (sizeof (u64), len);if (priv_size) {memset (self,0 , priv_size);
@@ -89,7 +89,7 @@ static void dso__insert_symbol(struct dso *self, struct symbol *sym) {struct rb_node **p = &self->syms.rb_node;struct rb_node *parent =NULL ; -const __u64 ip = sym->start; +const u64 ip = sym->start;struct symbol *s;while (*p !=NULL ) {
@@ -104,7 +104,7 @@ static void dso__insert_symbol(struct dso *self, struct symbol *sym)rb_insert_color (&sym->rb_node, &self->syms); } -struct symbol *dso__find_symbol (struct dso *self,__u64 ip) +struct symbol *dso__find_symbol (struct dso *self,u64 ip) {struct rb_node *n;
@@ -151,7 +151,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb goto out_failure;while (!feof (file)) { -__u64 start; +u64 start;struct symbol *sym;int line_len, len;char symbol_type;
@@ -232,7 +232,7 @@ static int dso__load_perf_map(struct dso *self, symbol_filter_t filter, int verb goto out_failure;while (!feof (file)) { -__u64 start, size; +u64 start, size;struct symbol *sym;int line_len, len;
@@ -353,7 +353,7 @@ static int dso__synthesize_plt_symbols(struct dso *self, Elf *elf, {uint32_t nr_rel_entries, idx;GElf_Sym sym; -__u64 plt_offset; +u64 plt_offset;GElf_Shdr shdr_plt;struct symbol *f;GElf_Shdr shdr_rel_plt;
@@ -523,7 +523,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,elf_symtab__for_each_symbol (syms, nr_syms, index, sym) {struct symbol *f; -__u64 obj_start; +u64 obj_start;if (!elf_sym__is_function (&sym))continue ;
tools/perf/util/symbol.h +8 -7
@@ -2,16 +2,17 @@#define _PERF_SYMBOL_ 1#include <linux/types.h> +#include "../types.h" #include "list.h" #include "rbtree.h" struct symbol {struct rb_node rb_node; -__u64 start; -__u64 end; -__u64 obj_start; -__u64 hist_sum; -__u64 *hist; +u64 start; +u64 end; +u64 obj_start; +u64 hist_sum; +u64 *hist;void *priv;char name[0 ]; };
@@ -20,7 +21,7 @@ struct dso {struct list_head node;struct rb_root syms;unsigned int sym_priv_size; -struct symbol *(*find_symbol)(struct dso *,__u64 ip); +struct symbol *(*find_symbol)(struct dso *,u64 ip);char name[0 ]; };
@@ -36,7 +37,7 @@ static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)return ((void *)sym) - self->sym_priv_size; } -struct symbol *dso__find_symbol (struct dso *self,__u64 ip); +struct symbol *dso__find_symbol (struct dso *self,u64 ip);int dso__load_kernel (struct dso *self,const char *vmlinux,symbol_filter_t filter,int verbose);
Signature · 1 line
1.6.0.4
Quoted 20 lines · Paul Mackerras
On 64-bit powerpc,
__u64is defined to be unsigned long rather than unsigned long long. This causes compiler warnings every time we print a__u64value with %Lx.Rather than changing
__u64, we define our own u64 to be unsigned long long on all architectures, and similarly s64 as signed long long. For consistency we also define u32, s32, u16, s16, u8 and s8. These definitions are put in a new header,types.h, because these definitions are needed inutil/string.handutil/symbol.h.The main change here is the mechanical change of __[us]{64,32,16,8} to remove the "__". The other changes are:
* Create
types.h
* Includetypes.hinperf.h,util/string.handutil/symbol.h
* Addtypes.hto theLIB_Hdefinition inMakefile
* Added (u64) casts inprocess_overflow_event()andprint_sym_table()to kill two remaining warnings.Signed-off-by Paul Mackerras <[email protected]>
Quoted 16 lines
--- tools/perf/Makefile | 1 + tools/perf/builtin-annotate.c | 66 ++++++++++++++++---------------- tools/perf/builtin-record.c | 20 +++++----- tools/perf/builtin-report.c | 80 ++++++++++++++++++++-------------------- tools/perf/builtin-stat.c | 62 +++++++++++++++--------------- tools/perf/builtin-top.c | 24 ++++++------ tools/perf/perf.h | 1 + tools/perf/types.h | 17 ++++++++ tools/perf/util/parse-events.c | 10 ++-- tools/perf/util/string.c | 2 +- tools/perf/util/string.h | 4 +- tools/perf/util/symbol.c | 20 +++++----- tools/perf/util/symbol.h | 15 ++++--- 13 files changed, 171 insertions(+), 151 deletions(-) create mode 100644 tools/perf/types.h
Very nice, thanks a lot Paul for going through this!
Ingo
[tip:perfcounters/core] perf_counter tools: Define and use our own u64, s64 etc. definitions
In reply to Paul MackerrasCommit-ID: 9cffa8d53335d891cc0ecb3824a67118b3ee4b2f Gitweb: http://git.kernel.org/tip/9cffa8d53335d891cc0ecb3824a67118b3ee4b2f Author: Paul Mackerras <[email protected]> AuthorDate: Fri, 19 Jun 2009 22:21:42 +1000 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 19 Jun 2009 18:25:47 +0200
perf_counter tools: Define and use our own u64, s64 etc. definitions
On 64-bit powerpc, __u64 is defined to be unsigned long rather than unsigned long long. This causes compiler warnings every time we print a __u64 value with %Lx.
Rather than changing __u64, we define our own u64 to be unsigned long long on all architectures, and similarly s64 as signed long long. For consistency we also define u32, s32, u16, s16, u8 and s8. These definitions are put in a new header, types.h, because these definitions are needed in util/string.h and util/symbol.h.
The main change here is the mechanical change of __[us]{64,32,16,8} to remove the "__". The other changes are:
* Create types.h
* Include types.h in perf.h, util/string.h and util/symbol.h
* Add types.h to the LIB_H definition in Makefile
* Added (u64) casts in process_overflow_event() and print_sym_table() to kill two remaining warnings.
LKML-Reference: <[email protected]>
--- tools/perf/Makefile | 1 + tools/perf/builtin-annotate.c | 66 ++++++++++++++++---------------- tools/perf/builtin-record.c | 20 +++++----- tools/perf/builtin-report.c | 84 ++++++++++++++++++++-------------------- tools/perf/builtin-stat.c | 62 +++++++++++++++--------------- tools/perf/builtin-top.c | 24 ++++++------ tools/perf/perf.h | 7 ++- tools/perf/types.h | 17 ++++++++ tools/perf/util/parse-events.c | 10 ++-- tools/perf/util/string.c | 2 +- tools/perf/util/string.h | 4 +- tools/perf/util/symbol.c | 20 +++++----- tools/perf/util/symbol.h | 15 ++++--- 13 files changed, 176 insertions(+), 156 deletions(-)
tools/perf/Makefile +1 -0
@@ -290,6 +290,7 @@ LIB_FILE=libperf.a LIB_H += ../../include/linux/perf_counter.h LIB_H += perf.h +LIB_H += types.h LIB_H += util/list.h LIB_H += util/rbtree.h LIB_H += util/levenshtein.h
tools/perf/builtin-annotate.c +33 -33
198 lines not on this page · raw message
tools/perf/builtin-record.c +10 -10
@@ -44,7 +44,7 @@ static long samples;static struct timeval last_read;static struct timeval this_read; -static __u64 bytes_written; +static u64 bytes_written;static struct pollfd event_array[MAX_NR_CPUS *MAX_COUNTERS ];
@@ -56,18 +56,18 @@ static struct perf_file_header file_header;struct mmap_event {struct perf_event_header header; -__u32 pid; -__u32 tid; -__u64 start; -__u64 len; -__u64 pgoff; +u32 pid; +u32 tid; +u64 start; +u64 len; +u64 pgoff;char filename[PATH_MAX ]; };struct comm_event {struct perf_event_header header; -__u32 pid; -__u32 tid; +u32 pid; +u32 tid;char comm[16 ]; };
@@ -238,7 +238,7 @@ static void pid_synthesize_comm_event(pid_t pid, int full) comm_ev.pid = pid; comm_ev.header.type =PERF_EVENT_COMM ; - size =ALIGN (size,sizeof (__u64)); + size =ALIGN (size,sizeof (u64)); comm_ev.header.size =sizeof (comm_ev) - (sizeof (comm_ev.comm) - size);if (!full) {
@@ -315,7 +315,7 @@ static void pid_synthesize_mmap_samples(pid_t pid) size =strlen (execname); execname[size -1 ] ='\0' ;/* Remove \n */ memcpy (mmap_ev.filename, execname, size); - size =ALIGN (size,sizeof (__u64)); + size =ALIGN (size,sizeof (u64)); mmap_ev.len -= mmap_ev.start; mmap_ev.header.size = (sizeof (mmap_ev) - (sizeof (mmap_ev.filename) - size));
tools/perf/builtin-report.c +42 -42
228 lines not on this page · raw message
tools/perf/builtin-stat.c +31 -31
138 lines not on this page · raw message
tools/perf/builtin-top.c +12 -12
@@ -54,7 +54,7 @@ static int system_wide = 0;static int default_interval =100000 ; -static __u64 count_filter =5 ; +static u64 count_filter =5 ;static int print_entries =15 ;static int target_pid =-1 ;
@@ -79,8 +79,8 @@ static int dump_symtab;* Symbols */ -static __u64 min_ip; -static __u64 max_ip =-1ll ; +static u64 min_ip; +static u64 max_ip =-1ll ;struct sym_entry {struct rb_node rb_node;
@@ -194,7 +194,7 @@ static void print_sym_table(void) 100.0 - (100.0*((samples_per_sec-ksamples_per_sec)/samples_per_sec)));if (nr_counters ==1 ) { -printf ("%Ld" , attrs[0 ].sample_period); +printf ("%Ld" , (u64 )attrs[0 ].sample_period);if (freq)printf ("Hz " );else
@@ -372,7 +372,7 @@ out_delete_dso:/* * Binary search in the histogram table and record the hit: */ -static void record_ip (__u64 ip,int counter) +static void record_ip (u64 ip,int counter) {struct symbol *sym =dso__find_symbol (kernel_dso, ip);
@@ -392,7 +392,7 @@ static void record_ip(__u64 ip, int counter) samples--; } -static void process_event (__u64 ip,int counter) +static void process_event (u64 ip,int counter) { samples++;
@@ -463,15 +463,15 @@ static void mmap_read_counter(struct mmap_data *md)for (; old != head;) {struct ip_event {struct perf_event_header header; -__u64 ip; -__u32 pid, target_pid; +u64 ip; +u32 pid, target_pid; };struct mmap_event {struct perf_event_header header; -__u32 pid, target_pid; -__u64 start; -__u64 len; -__u64 pgoff; +u32 pid, target_pid; +u64 start; +u64 len; +u64 pgoff;char filename[PATH_MAX ]; };
tools/perf/perf.h +4 -3
@@ -19,6 +19,7 @@#include <sys/syscall.h> #include "../../include/linux/perf_counter.h" +#include "types.h" /* * prctl(PR_TASK_PERF_COUNTERS_DISABLE) will (cheaply) disable all
@@ -66,9 +67,9 @@ sys_perf_counter_open(struct perf_counter_attr *attr,#define MAX_NR_CPUS 256struct perf_file_header { -__u64 version; -__u64 sample_type; -__u64 data_size; +u64 version; +u64 sample_type; +u64 data_size; };#endif
tools/perf/types.h new file +17 -0
@@ -0,0 +1,17 @@ +#ifndef _PERF_TYPES_H +#define _PERF_TYPES_H + +/* +* We define u64 as unsigned long long for every architecture +* so that we can print it with %Lx without getting warnings. +*/ +typedef unsigned long long u64 ; +typedef signed long long s64 ; +typedef unsigned int u32 ; +typedef signed int s32 ; +typedef unsigned short u16 ; +typedef signed short s16 ; +typedef unsigned char u8 ; +typedef signed char s8 ; + +#endif /* _PERF_TYPES_H */
tools/perf/util/parse-events.c +5 -5
@@ -13,8 +13,8 @@ int nr_counters;struct perf_counter_attr attrs[MAX_COUNTERS ];struct event_symbol { -__u8 type; -__u64 config; +u8 type; +u64 config;char *symbol; };
@@ -96,7 +96,7 @@ static char *hw_cache_result [][MAX_ALIASES] = {char *event_name (int counter) { -__u64 config = attrs[counter].config; +u64 config = attrs[counter].config;int type = attrs[counter].type;static char buf[32 ];
@@ -112,7 +112,7 @@ char *event_name(int counter)return "unknown-hardware" ;case PERF_TYPE_HW_CACHE : { -__u8 cache_type, cache_op, cache_result; +u8 cache_type, cache_op, cache_result;static char name[100 ]; cache_type = (config >>0 ) &0xff ;
@@ -202,7 +202,7 @@ static int parse_generic_hw_symbols(const char *str, struct perf_counter_attr *a*/ static int parse_event_symbols (const char *str,struct perf_counter_attr *attr) { -__u64 config, id; +u64 config, id;int type;unsigned int i;const char *sep, *pstr;
tools/perf/util/string.c +1 -1
@@ -15,7 +15,7 @@ static int hex(char ch)* While we find nice hex chars, build a long_val. * Return number of chars processed. */ -int hex2u64 (const char *ptr,__u64 *long_val) +int hex2u64 (const char *ptr,u64 *long_val) {const char *p = ptr; *long_val =0 ;
tools/perf/util/string.h +2 -2
@@ -1,8 +1,8 @@#ifndef _PERF_STRING_H_#define _PERF_STRING_H_ -#include <linux/types.h> +#include "../types.h" -int hex2u64 (const char *ptr,__u64 *val); +int hex2u64 (const char *ptr,u64 *val);#endif
tools/perf/util/symbol.c +10 -10
@@ -9,9 +9,9 @@const char *sym_hist_filter; -static struct symbol *symbol__new (__u64 start,__u64 len, +static struct symbol *symbol__new (u64 start,u64 len,const char *name,unsigned int priv_size, -__u64 obj_start,int verbose) +u64 obj_start,int verbose) {size_t namelen =strlen (name) +1 ;struct symbol *self =calloc (1 , priv_size +sizeof (*self) + namelen);
@@ -21,14 +21,14 @@ static struct symbol *symbol__new(__u64 start, __u64 len,if (verbose >=2 )printf ("new symbol: %016Lx [%08lx]: %s, hist: %p, obj_start: %p\n" , - (__u64 )start, (unsigned long )len, name, self->hist, (void *)(unsigned long )obj_start); + (u64 )start, (unsigned long )len, name, self->hist, (void *)(unsigned long )obj_start); self->obj_start= obj_start; self->hist =NULL ; self->hist_sum =0 ;if (sym_hist_filter && !strcmp (name, sym_hist_filter)) - self->hist =calloc (sizeof (__u64), len); + self->hist =calloc (sizeof (u64), len);if (priv_size) {memset (self,0 , priv_size);
@@ -89,7 +89,7 @@ static void dso__insert_symbol(struct dso *self, struct symbol *sym) {struct rb_node **p = &self->syms.rb_node;struct rb_node *parent =NULL ; -const __u64 ip = sym->start; +const u64 ip = sym->start;struct symbol *s;while (*p !=NULL ) {
@@ -104,7 +104,7 @@ static void dso__insert_symbol(struct dso *self, struct symbol *sym)rb_insert_color (&sym->rb_node, &self->syms); } -struct symbol *dso__find_symbol (struct dso *self,__u64 ip) +struct symbol *dso__find_symbol (struct dso *self,u64 ip) {struct rb_node *n;
@@ -151,7 +151,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb goto out_failure;while (!feof (file)) { -__u64 start; +u64 start;struct symbol *sym;int line_len, len;char symbol_type;
@@ -232,7 +232,7 @@ static int dso__load_perf_map(struct dso *self, symbol_filter_t filter, int verb goto out_failure;while (!feof (file)) { -__u64 start, size; +u64 start, size;struct symbol *sym;int line_len, len;
@@ -353,7 +353,7 @@ static int dso__synthesize_plt_symbols(struct dso *self, Elf *elf, {uint32_t nr_rel_entries, idx;GElf_Sym sym; -__u64 plt_offset; +u64 plt_offset;GElf_Shdr shdr_plt;struct symbol *f;GElf_Shdr shdr_rel_plt;
@@ -523,7 +523,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,elf_symtab__for_each_symbol (syms, nr_syms, index, sym) {struct symbol *f; -__u64 obj_start; +u64 obj_start;if (!elf_sym__is_function (&sym))continue ;
tools/perf/util/symbol.h +8 -7
@@ -2,16 +2,17 @@#define _PERF_SYMBOL_ 1#include <linux/types.h> +#include "../types.h" #include "list.h" #include "rbtree.h" struct symbol {struct rb_node rb_node; -__u64 start; -__u64 end; -__u64 obj_start; -__u64 hist_sum; -__u64 *hist; +u64 start; +u64 end; +u64 obj_start; +u64 hist_sum; +u64 *hist;void *priv;char name[0 ]; };
@@ -20,7 +21,7 @@ struct dso {struct list_head node;struct rb_root syms;unsigned int sym_priv_size; -struct symbol *(*find_symbol)(struct dso *,__u64 ip); +struct symbol *(*find_symbol)(struct dso *,u64 ip);char name[0 ]; };
@@ -36,7 +37,7 @@ static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)return ((void *)sym) - self->sym_priv_size; } -struct symbol *dso__find_symbol (struct dso *self,__u64 ip); +struct symbol *dso__find_symbol (struct dso *self,u64 ip);int dso__load_kernel (struct dso *self,const char *vmlinux,symbol_filter_t filter,int verbose);