perf dso: Separate dso symbols to separate object
cover perf dso: Separate dso symbols to separate object
hi,
separating dso related stuff into dso object plus some other symbol object cleanup. It's just a code moving, no actual change was done.
Attached patches:
1/5 perf tool: Move build_id__sprintf into build-id object 2/5 perf tool: Move BUILD_ID_SIZE into build-id object 3/5 perf tool: Move hex2u64 into util object
4/5 perf tool: Move strxfrchar into string object 5/5 perf tool: Move dso_* related functions into dso object
Also available in:git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/linux.git
perf/dso1
thanks,
jirka
--- tools/perf/Makefile | 2 + tools/perf/builtin-buildid-cache.c | 1 + tools/perf/util/annotate.c | 1 + tools/perf/util/build-id.c | 15 ++ tools/perf/util/build-id.h | 7 +- tools/perf/util/dso.c | 594 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/dso.h | 148 +++++++++++++++ tools/perf/util/event.h | 3 +- tools/perf/util/header.c | 1 + tools/perf/util/map.c | 1 + tools/perf/util/string.c | 18 ++ tools/perf/util/symbol.c | 657 +------------------------------------------------------------------ tools/perf/util/symbol.h | 141 +-------------- tools/perf/util/util.c | 33 ++++ tools/perf/util/util.h | 2 + 15 files changed, 831 insertions(+), 793 deletions(-)
PATCH 1/5 perf tool: Move build_id__sprintf into build-id object
Moving build_id__sprintf function into build-id object.
--- tools/perf/builtin-buildid-cache.c | 2 +- tools/perf/util/build-id.c | 15 +++++++++++++++ tools/perf/util/build-id.h | 1 + tools/perf/util/header.c | 1 + tools/perf/util/map.c | 1 + tools/perf/util/symbol.c | 15 --------------- tools/perf/util/symbol.h | 1 - 7 files changed, 19 insertions(+), 17 deletions(-)
tools/perf/builtin-buildid-cache.c +1 -1
@@ -13,7 +13,7 @@#include "util/header.h" #include "util/parse-options.h" #include "util/strlist.h" -#include "util/symbol.h" +#include "util/build-id.h" static int build_id_cache__add_file (const char *filename,const char *debugdir) {
tools/perf/util/build-id.c +15 -0
@@ -70,6 +70,21 @@ struct perf_tool build_id__mark_dso_hit_ops = { .build_id = perf_event__process_build_id, }; +int build_id__sprintf (const u8 *build_id,int len,char *bf) +{ +char *bid = bf; +const u8 *raw = build_id; +int i; + +for (i =0 ; i < len; ++i) { +sprintf (bid,"%02x" , *raw); + ++raw; + bid +=2 ; + } + +return raw - build_id; +} +char *dso__build_id_filename (struct dso *self,char *bf,size_t size) {char build_id_hex[BUILD_ID_SIZE *2 +1 ];
tools/perf/util/build-id.h +1 -0
@@ -5,6 +5,7 @@extern struct perf_tool build_id__mark_dso_hit_ops; +int build_id__sprintf (const u8 *build_id,int len,char *bf);char *dso__build_id_filename (struct dso *self,char *bf,size_t size); int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event,
tools/perf/util/header.c +1 -0
@@ -23,6 +23,7 @@#include "pmu.h" #include "vdso.h" #include "strbuf.h" +#include "build-id.h" static bool no_buildid_cache = false;
tools/perf/util/map.c +1 -0
@@ -10,6 +10,7 @@#include "thread.h" #include "strlist.h" #include "vdso.h" +#include "build-id.h" const char *map_type__name[MAP__NR_TYPES ] = { [MAP__FUNCTION ] ="Functions" ,
tools/perf/util/symbol.c +0 -15
@@ -504,21 +504,6 @@ void dso__sort_by_name(struct dso *dso, enum map_type type) &dso->symbols[type]); } -int build_id__sprintf (const u8 *build_id,int len,char *bf) -{ -char *bid = bf; -const u8 *raw = build_id; -int i; - -for (i =0 ; i < len; ++i) { -sprintf (bid,"%02x" , *raw); - ++raw; - bid +=2 ; - } - -return raw - build_id; -} -size_t dso__fprintf_buildid (struct dso *dso,FILE *fp) {char sbuild_id[BUILD_ID_SIZE *2 +1 ];
tools/perf/util/symbol.h +0 -1
@@ -338,7 +338,6 @@ struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,int filename__read_build_id (const char *filename,void *bf,size_t size);int sysfs__read_build_id (const char *filename,void *bf,size_t size);bool __dsos__read_build_ids (struct list_head *head,bool with_hits); -int build_id__sprintf (const u8 *build_id,int len,char *bf);int kallsyms__parse (const char *filename,void *arg,int (*process_symbol)(void *arg,const char *name,char type,u64 start));
Signature · 1 line
1.7.11.7
[tip:perf/core] perf tools: Move build_id__sprintf into build-id object
Commit-ID: ebb296c276ca19798c3116220eb8d0b2c0975ae0 Gitweb: http://git.kernel.org/tip/ebb296c276ca19798c3116220eb8d0b2c0975ae0 Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 27 Oct 2012 23:18:28 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 29 Oct 2012 11:34:46 -0200
perf tools: Move build_id__sprintf into build-id object
Moving build_id__sprintf function into build-id object.
--- tools/perf/builtin-buildid-cache.c | 2 +- tools/perf/util/build-id.c | 15 +++++++++++++++ tools/perf/util/build-id.h | 1 + tools/perf/util/header.c | 1 + tools/perf/util/map.c | 1 + tools/perf/util/symbol.c | 15 --------------- tools/perf/util/symbol.h | 1 - 7 files changed, 19 insertions(+), 17 deletions(-)
tools/perf/builtin-buildid-cache.c +1 -1
@@ -13,7 +13,7 @@#include "util/header.h" #include "util/parse-options.h" #include "util/strlist.h" -#include "util/symbol.h" +#include "util/build-id.h" static int build_id_cache__add_file (const char *filename,const char *debugdir) {
tools/perf/util/build-id.c +15 -0
@@ -70,6 +70,21 @@ struct perf_tool build_id__mark_dso_hit_ops = { .build_id = perf_event__process_build_id, }; +int build_id__sprintf (const u8 *build_id,int len,char *bf) +{ +char *bid = bf; +const u8 *raw = build_id; +int i; + +for (i =0 ; i < len; ++i) { +sprintf (bid,"%02x" , *raw); + ++raw; + bid +=2 ; + } + +return raw - build_id; +} +char *dso__build_id_filename (struct dso *self,char *bf,size_t size) {char build_id_hex[BUILD_ID_SIZE *2 +1 ];
tools/perf/util/build-id.h +1 -0
@@ -5,6 +5,7 @@extern struct perf_tool build_id__mark_dso_hit_ops; +int build_id__sprintf (const u8 *build_id,int len,char *bf);char *dso__build_id_filename (struct dso *self,char *bf,size_t size); int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event,
tools/perf/util/header.c +1 -0
@@ -23,6 +23,7 @@#include "pmu.h" #include "vdso.h" #include "strbuf.h" +#include "build-id.h" static bool no_buildid_cache = false;
tools/perf/util/map.c +1 -0
@@ -10,6 +10,7 @@#include "thread.h" #include "strlist.h" #include "vdso.h" +#include "build-id.h" const char *map_type__name[MAP__NR_TYPES ] = { [MAP__FUNCTION ] ="Functions" ,
tools/perf/util/symbol.c +0 -15
@@ -504,21 +504,6 @@ void dso__sort_by_name(struct dso *dso, enum map_type type) &dso->symbols[type]); } -int build_id__sprintf (const u8 *build_id,int len,char *bf) -{ -char *bid = bf; -const u8 *raw = build_id; -int i; - -for (i =0 ; i < len; ++i) { -sprintf (bid,"%02x" , *raw); - ++raw; - bid +=2 ; - } - -return raw - build_id; -} -size_t dso__fprintf_buildid (struct dso *dso,FILE *fp) {char sbuild_id[BUILD_ID_SIZE *2 +1 ];
tools/perf/util/symbol.h +0 -1
@@ -338,7 +338,6 @@ struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,int filename__read_build_id (const char *filename,void *bf,size_t size);int sysfs__read_build_id (const char *filename,void *bf,size_t size);bool __dsos__read_build_ids (struct list_head *head,bool with_hits); -int build_id__sprintf (const u8 *build_id,int len,char *bf);int kallsyms__parse (const char *filename,void *arg,int (*process_symbol)(void *arg,const char *name,char type,u64 start));
PATCH 2/5 perf tool: Move BUILD_ID_SIZE into build-id object
In reply to Jiri OlsaMoving BUILD_ID_SIZE define into build-id object, plus include related changes.
--- tools/perf/builtin-buildid-cache.c | 1 + tools/perf/util/annotate.c | 1 + tools/perf/util/build-id.h | 6 +++++- tools/perf/util/event.h | 3 +-- tools/perf/util/symbol.h | 3 +-- 5 files changed, 9 insertions(+), 5 deletions(-)
tools/perf/builtin-buildid-cache.c +1 -0
@@ -14,6 +14,7 @@#include "util/parse-options.h" #include "util/strlist.h" #include "util/build-id.h" +#include "util/symbol.h" static int build_id_cache__add_file (const char *filename,const char *debugdir) {
tools/perf/util/annotate.c +1 -0
@@ -15,6 +15,7 @@#include "debug.h" #include "annotate.h" #include <pthread.h> +#include <linux/bitops.h> const char *disassembler_style;const char *objdump_path;
tools/perf/util/build-id.h +5 -1
@@ -1,9 +1,13 @@#ifndef PERF_BUILD_ID_H_ #define PERF_BUILD_ID_H_ 1 -#include "session.h" +#define BUILD_ID_SIZE 20 + +#include "tool.h" +#include "types.h" extern struct perf_tool build_id__mark_dso_hit_ops; +struct dso ;int build_id__sprintf (const u8 *build_id,int len,char *bf);char *dso__build_id_filename (struct dso *self,char *bf,size_t size);
tools/perf/util/event.h +1 -2
@@ -6,6 +6,7 @@#include "../perf.h" #include "map.h" +#include "build-id.h" /* * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
@@ -96,8 +97,6 @@ struct perf_sample {struct stack_dump user_stack; }; -#define BUILD_ID_SIZE 20 -struct build_id_event {struct perf_event_header header;pid_t pid;
tools/perf/util/symbol.h +1 -2
@@ -11,6 +11,7 @@#include <stdio.h> #include <byteswap.h> #include <libgen.h> +#include "build-id.h" #ifdef LIBELF_SUPPORT #include <libelf.h>
@@ -57,8 +58,6 @@ char *strxfrchar(char *s, char from, char to);#define DMGL_ANSI (1 << 1)/* Include const, volatile, etc */ #endif -#define BUILD_ID_SIZE 20 -/** struct symbol - symtab entry * * @ignore - resolvable but tools ignore it (e.g. idle routines)
Signature · 1 line
1.7.11.7
[tip:perf/core] perf tools: Move BUILD_ID_SIZE into build-id object
Commit-ID: 4383db88a7afb2664941ef1e82d41f5aad8be2ec Gitweb: http://git.kernel.org/tip/4383db88a7afb2664941ef1e82d41f5aad8be2ec Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 27 Oct 2012 23:18:29 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 29 Oct 2012 11:35:32 -0200
perf tools: Move BUILD_ID_SIZE into build-id object
Moving BUILD_ID_SIZE define into build-id object, plus include related changes.
--- tools/perf/builtin-buildid-cache.c | 1 + tools/perf/util/annotate.c | 1 + tools/perf/util/build-id.h | 6 +++++- tools/perf/util/event.h | 3 +-- tools/perf/util/symbol.h | 3 +-- 5 files changed, 9 insertions(+), 5 deletions(-)
tools/perf/builtin-buildid-cache.c +1 -0
@@ -14,6 +14,7 @@#include "util/parse-options.h" #include "util/strlist.h" #include "util/build-id.h" +#include "util/symbol.h" static int build_id_cache__add_file (const char *filename,const char *debugdir) {
tools/perf/util/annotate.c +1 -0
@@ -15,6 +15,7 @@#include "debug.h" #include "annotate.h" #include <pthread.h> +#include <linux/bitops.h> const char *disassembler_style;const char *objdump_path;
tools/perf/util/build-id.h +5 -1
@@ -1,9 +1,13 @@#ifndef PERF_BUILD_ID_H_ #define PERF_BUILD_ID_H_ 1 -#include "session.h" +#define BUILD_ID_SIZE 20 + +#include "tool.h" +#include "types.h" extern struct perf_tool build_id__mark_dso_hit_ops; +struct dso ;int build_id__sprintf (const u8 *build_id,int len,char *bf);char *dso__build_id_filename (struct dso *self,char *bf,size_t size);
tools/perf/util/event.h +1 -2
@@ -6,6 +6,7 @@#include "../perf.h" #include "map.h" +#include "build-id.h" /* * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
@@ -96,8 +97,6 @@ struct perf_sample {struct stack_dump user_stack; }; -#define BUILD_ID_SIZE 20 -struct build_id_event {struct perf_event_header header;pid_t pid;
tools/perf/util/symbol.h +1 -2
@@ -11,6 +11,7 @@#include <stdio.h> #include <byteswap.h> #include <libgen.h> +#include "build-id.h" #ifdef LIBELF_SUPPORT #include <libelf.h>
@@ -57,8 +58,6 @@ char *strxfrchar(char *s, char from, char to);#define DMGL_ANSI (1 << 1)/* Include const, volatile, etc */ #endif -#define BUILD_ID_SIZE 20 -/** struct symbol - symtab entry * * @ignore - resolvable but tools ignore it (e.g. idle routines)
PATCH 3/5 perf tool: Move hex2u64 into util object
In reply to Jiri OlsaMoving hex2u64 function into util object.
--- tools/perf/util/symbol.c | 33 --------------------------------- tools/perf/util/symbol.h | 1 - tools/perf/util/util.c | 33 +++++++++++++++++++++++++++++++++ tools/perf/util/util.h | 1 + 4 files changed, 34 insertions(+), 34 deletions(-)
tools/perf/util/symbol.c +0 -33
@@ -2050,39 +2050,6 @@ int machines__create_kernel_maps(struct rb_root *machines, pid_t pid)return machine__create_kernel_maps (machine); } -static int hex (char ch) -{ -if ((ch >='0' ) && (ch <='9' )) -return ch -'0' ; -if ((ch >='a' ) && (ch <='f' )) -return ch -'a' +10 ; -if ((ch >='A' ) && (ch <='F' )) -return ch -'A' +10 ; -return -1 ; -} - -/* -* While we find nice hex chars, build a long_val. -* Return number of chars processed. -*/ -int hex2u64 (const char *ptr,u64 *long_val) -{ -const char *p = ptr; - *long_val =0 ; - -while (*p) { -const int hex_val =hex (*p); - -if (hex_val <0 ) -break ; - - *long_val = (*long_val <<4 ) | hex_val; - p++; - } - -return p - ptr; -} -char *strxfrchar (char *s,char from,char to) {char *p = s;
tools/perf/util/symbol.h +0 -1
@@ -40,7 +40,6 @@ static inline char *bfd_demangle(void __maybe_unused *v,#endif #endif -int hex2u64 (const char *ptr,u64 *val);char *strxfrchar (char *s,char from,char to);/*
tools/perf/util/util.c +33 -0
@@ -166,6 +166,39 @@ size_t hex_width(u64 v)return n; } +static int hex (char ch) +{ +if ((ch >='0' ) && (ch <='9' )) +return ch -'0' ; +if ((ch >='a' ) && (ch <='f' )) +return ch -'a' +10 ; +if ((ch >='A' ) && (ch <='F' )) +return ch -'A' +10 ; +return -1 ; +} + +/* +* While we find nice hex chars, build a long_val. +* Return number of chars processed. +*/ +int hex2u64 (const char *ptr,u64 *long_val) +{ +const char *p = ptr; + *long_val =0 ; + +while (*p) { +const int hex_val =hex (*p); + +if (hex_val <0 ) +break ; + + *long_val = (*long_val <<4 ) | hex_val; + p++; + } + +return p - ptr; +} +/* Obtain a backtrace and print it to stdout. */ #ifdef BACKTRACE_SUPPORT void dump_stack (void )
tools/perf/util/util.h +1 -0
@@ -262,6 +262,7 @@ bool is_power_of_2(unsigned long n) }size_t hex_width (u64 v); +int hex2u64 (const char *ptr,u64 *val);char *rtrim (char *s);
Signature · 1 line
1.7.11.7
[tip:perf/core] perf tools: Move hex2u64 into util object
Commit-ID: b2aff5f615793fa4c1313d82635b83cd7de8d9fd Gitweb: http://git.kernel.org/tip/b2aff5f615793fa4c1313d82635b83cd7de8d9fd Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 27 Oct 2012 23:18:30 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 29 Oct 2012 11:36:02 -0200
perf tools: Move hex2u64 into util object
Moving hex2u64 function into util object.
--- tools/perf/util/symbol.c | 33 --------------------------------- tools/perf/util/symbol.h | 1 - tools/perf/util/util.c | 33 +++++++++++++++++++++++++++++++++ tools/perf/util/util.h | 1 + 4 files changed, 34 insertions(+), 34 deletions(-)
tools/perf/util/symbol.c +0 -33
@@ -2050,39 +2050,6 @@ int machines__create_kernel_maps(struct rb_root *machines, pid_t pid)return machine__create_kernel_maps (machine); } -static int hex (char ch) -{ -if ((ch >='0' ) && (ch <='9' )) -return ch -'0' ; -if ((ch >='a' ) && (ch <='f' )) -return ch -'a' +10 ; -if ((ch >='A' ) && (ch <='F' )) -return ch -'A' +10 ; -return -1 ; -} - -/* -* While we find nice hex chars, build a long_val. -* Return number of chars processed. -*/ -int hex2u64 (const char *ptr,u64 *long_val) -{ -const char *p = ptr; - *long_val =0 ; - -while (*p) { -const int hex_val =hex (*p); - -if (hex_val <0 ) -break ; - - *long_val = (*long_val <<4 ) | hex_val; - p++; - } - -return p - ptr; -} -char *strxfrchar (char *s,char from,char to) {char *p = s;
tools/perf/util/symbol.h +0 -1
@@ -40,7 +40,6 @@ static inline char *bfd_demangle(void __maybe_unused *v,#endif #endif -int hex2u64 (const char *ptr,u64 *val);char *strxfrchar (char *s,char from,char to);/*
tools/perf/util/util.c +33 -0
@@ -166,6 +166,39 @@ size_t hex_width(u64 v)return n; } +static int hex (char ch) +{ +if ((ch >='0' ) && (ch <='9' )) +return ch -'0' ; +if ((ch >='a' ) && (ch <='f' )) +return ch -'a' +10 ; +if ((ch >='A' ) && (ch <='F' )) +return ch -'A' +10 ; +return -1 ; +} + +/* +* While we find nice hex chars, build a long_val. +* Return number of chars processed. +*/ +int hex2u64 (const char *ptr,u64 *long_val) +{ +const char *p = ptr; + *long_val =0 ; + +while (*p) { +const int hex_val =hex (*p); + +if (hex_val <0 ) +break ; + + *long_val = (*long_val <<4 ) | hex_val; + p++; + } + +return p - ptr; +} +/* Obtain a backtrace and print it to stdout. */ #ifdef BACKTRACE_SUPPORT void dump_stack (void )
tools/perf/util/util.h +1 -0
@@ -262,6 +262,7 @@ bool is_power_of_2(unsigned long n) }size_t hex_width (u64 v); +int hex2u64 (const char *ptr,u64 *val);char *rtrim (char *s);
PATCH 4/5 perf tool: Move strxfrchar into string object
In reply to Jiri OlsaMoving strxfrchar function into string object.
--- tools/perf/util/string.c | 18 ++++++++++++++++++ tools/perf/util/symbol.c | 10 ---------- tools/perf/util/symbol.h | 2 -- tools/perf/util/util.h | 1 + 4 files changed, 19 insertions(+), 12 deletions(-)
tools/perf/util/string.c +18 -0
@@ -314,6 +314,24 @@ int strtailcmp(const char *s1, const char *s2) }/** +* strxfrchar - Locate and replace character in @s +* @s: The string to be searched/changed. +* @from: Source character to be replaced. +* @to: Destination character. +* +* Return pointer to the changed string. +*/ +char *strxfrchar (char *s,char from,char to) +{ +char *p = s; + +while ((p =strchr (p, from)) !=NULL ) + *p++ = to; + +return s; +} + +/** * rtrim - Removes trailing whitespace from @s. * @s: The string to be stripped. *
tools/perf/util/symbol.c +0 -10
@@ -2050,16 +2050,6 @@ int machines__create_kernel_maps(struct rb_root *machines, pid_t pid)return machine__create_kernel_maps (machine); } -char *strxfrchar (char *s,char from,char to) -{ -char *p = s; - -while ((p =strchr (p, from)) !=NULL ) - *p++ = to; - -return s; -} -int machines__create_guest_kernel_maps (struct rb_root *machines) {int ret =0 ;
tools/perf/util/symbol.h +0 -2
@@ -40,8 +40,6 @@ static inline char *bfd_demangle(void __maybe_unused *v,#endif #endif -char *strxfrchar (char *s,char from,char to); -/* * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; * for newer versions we can use mmap to reduce memory usage:
tools/perf/util/util.h +1 -0
@@ -240,6 +240,7 @@ void argv_free(char **argv);bool strglobmatch (const char *str,const char *pat);bool strlazymatch (const char *str,const char *pat);int strtailcmp (const char *s1,const char *s2); +char *strxfrchar (char *s,char from,char to);unsigned long convert_unit (unsigned long value,char *unit);int readn (int fd,void *buf,size_t size);
Signature · 1 line
1.7.11.7
[tip:perf/core] perf tools: Move strxfrchar into string object
Commit-ID: ea36c46be69c6e49c877971c4b3b3876b24b6082 Gitweb: http://git.kernel.org/tip/ea36c46be69c6e49c877971c4b3b3876b24b6082 Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 27 Oct 2012 23:18:31 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 29 Oct 2012 11:36:28 -0200
perf tools: Move strxfrchar into string object
Moving strxfrchar function into string object.
--- tools/perf/util/string.c | 18 ++++++++++++++++++ tools/perf/util/symbol.c | 10 ---------- tools/perf/util/symbol.h | 2 -- tools/perf/util/util.h | 1 + 4 files changed, 19 insertions(+), 12 deletions(-)
tools/perf/util/string.c +18 -0
@@ -314,6 +314,24 @@ int strtailcmp(const char *s1, const char *s2) }/** +* strxfrchar - Locate and replace character in @s +* @s: The string to be searched/changed. +* @from: Source character to be replaced. +* @to: Destination character. +* +* Return pointer to the changed string. +*/ +char *strxfrchar (char *s,char from,char to) +{ +char *p = s; + +while ((p =strchr (p, from)) !=NULL ) + *p++ = to; + +return s; +} + +/** * rtrim - Removes trailing whitespace from @s. * @s: The string to be stripped. *
tools/perf/util/symbol.c +0 -10
@@ -2050,16 +2050,6 @@ int machines__create_kernel_maps(struct rb_root *machines, pid_t pid)return machine__create_kernel_maps (machine); } -char *strxfrchar (char *s,char from,char to) -{ -char *p = s; - -while ((p =strchr (p, from)) !=NULL ) - *p++ = to; - -return s; -} -int machines__create_guest_kernel_maps (struct rb_root *machines) {int ret =0 ;
tools/perf/util/symbol.h +0 -2
@@ -40,8 +40,6 @@ static inline char *bfd_demangle(void __maybe_unused *v,#endif #endif -char *strxfrchar (char *s,char from,char to); -/* * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; * for newer versions we can use mmap to reduce memory usage:
tools/perf/util/util.h +1 -0
@@ -240,6 +240,7 @@ void argv_free(char **argv);bool strglobmatch (const char *str,const char *pat);bool strlazymatch (const char *str,const char *pat);int strtailcmp (const char *s1,const char *s2); +char *strxfrchar (char *s,char from,char to);unsigned long convert_unit (unsigned long value,char *unit);int readn (int fd,void *buf,size_t size);
PATCH 5/5 perf tool: Move dso_* related functions into dso object
In reply to Jiri OlsaMoving dso_* related functions into dso object.
Keeping symbol loading related functions still in the symbol object as it seems more convenient.
--- tools/perf/Makefile | 2 + tools/perf/util/dso.c | 594 ++++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/dso.h | 148 ++++++++++++ tools/perf/util/symbol.c | 599 +---------------------------------------------- tools/perf/util/symbol.h | 134 +---------- 5 files changed, 751 insertions(+), 726 deletions(-) create mode 100644 tools/perf/util/dso.c create mode 100644 tools/perf/util/dso.h
tools/perf/Makefile +2 -0
@@ -327,6 +327,7 @@ LIB_H += util/svghelper.h LIB_H += util/tool.h LIB_H += util/run-command.h LIB_H += util/sigchain.h +LIB_H += util/dso.h LIB_H += util/symbol.h LIB_H += util/color.h LIB_H += util/values.h
@@ -385,6 +386,7 @@ LIB_OBJS += $(OUTPUT)util/top.o LIB_OBJS += $(OUTPUT)util/usage.o LIB_OBJS += $(OUTPUT)util/wrapper.o LIB_OBJS += $(OUTPUT)util/sigchain.o +LIB_OBJS += $(OUTPUT)util/dso.o LIB_OBJS += $(OUTPUT)util/symbol.o LIB_OBJS += $(OUTPUT)util/symbol-elf.o LIB_OBJS += $(OUTPUT)util/dso-test-data.o
tools/perf/util/dso.c new file +594 -0
594 lines not on this page · raw message
tools/perf/util/dso.h new file +148 -0
148 lines not on this page · raw message
tools/perf/util/symbol.c +2 -597
674 lines not on this page · raw message
tools/perf/util/symbol.h +5 -129
185 lines not on this page · raw message
Signature · 1 line
1.7.11.7
Re: [PATCH 5/5] perf tool: Move dso_* related functions into dso object
Em Sat, Oct 27, 2012 at 11:18:32PM +0200, Jiri Olsa escreveu:
Quoted 4 lines
Moving dso_* related functions into dso object.
Keeping symbol loading related functions still in the symbol object as it seems more convenient.
Please resubmit after you fix this: The other 4 patches I already applied to my local tree.
- Arnaldo
CC /home/acme/git/build/perf/util/dso-test-data.o
In file included from util/dso.c:2:util/dso.h:87: error: ‘BUILD_ID_SIZE’ undeclared here (not in a function)
CC /home/acme/git/build/perf/util/color.o
cc1: warnings being treated as errorsutil/dso.c: In function ‘dso__binary_type_file’:util/dso.c:45: error: implicit declaration of function ‘filename__read_debuglink’ util/dso.c:45: error: nested extern declaration of ‘filename__read_debuglink’ util/dso.c:51: error: ‘symbol_conf’ undeclared (first use in this function) util/dso.c:51: error: (Each undeclared identifier is reported only once util/dso.c:51: error: for each function it appears in.)util/dso.c: In function ‘dso__delete’:util/dso.c:435: error: implicit declaration of function ‘symbols__delete’ util/dso.c:435: error: nested extern declaration of ‘symbols__delete’ util/dso.c: In function ‘dso__read_running_kernel_build_id’:util/dso.c:462: error: implicit declaration of function ‘sysfs__read_build_id’ util/dso.c:462: error: nested extern declaration of ‘sysfs__read_build_id’ util/dso.c: In function ‘__dsos__read_build_ids’:util/dso.c:500: error: implicit declaration of function ‘filename__read_build_id’ util/dso.c:500: error: nested extern declaration of ‘filename__read_build_id’ util/dso.c: In function ‘dso__fprintf’:util/dso.c:589: error: dereferencing pointer to incomplete type util/dso.c:589: error: type defaults to ‘int’ in declaration of ‘__mptr’ util/dso.c:589: error: initialization from incompatible pointer type util/dso.c:589: error: invalid use of undefined type ‘struct symbol’ util/dso.c:590: error: implicit declaration of function ‘symbol__fprintf’ util/dso.c:590: error: nested extern declaration of ‘symbol__fprintf’
make: *** [/home/acme/git/build/perf/util/dso.o] Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory `/home/git/linux/tools/perf'
[acme@sandy linux]$
Re: [PATCH 5/5] perf tool: Move dso_* related functions into dso object
Quoted 30 lines · Arnaldo Carvalho de Melo
Em Sat, Oct 27, 2012 at 11:18:32PM +0200, Jiri Olsa escreveu:
Quoted 4 lines
Moving dso_* related functions into dso object.
Keeping symbol loading related functions still in the symbol object as it seems more convenient.
Please resubmit after you fix this: The other 4 patches I already applied to my local tree.
- Arnaldo
CC
/home/acme/git/build/perf/util/dso-test-data.o
In file included fromutil/dso.c:2:util/dso.h:87: error: ‘BUILD_ID_SIZE’ undeclared here (not in a function)
CC/home/acme/git/build/perf/util/color.o
cc1: warnings being treated as errorsutil/dso.c: In function ‘dso__binary_type_file’:util/dso.c:45: error: implicit declaration of function ‘filename__read_debuglink’util/dso.c:45: error: nested extern declaration of ‘filename__read_debuglink’util/dso.c:51: error: ‘symbol_conf’ undeclared (first use in this function)util/dso.c:51: error: (Each undeclared identifier is reported only onceutil/dso.c:51: error: for each function it appears in.)util/dso.c: In function ‘dso__delete’:util/dso.c:435: error: implicit declaration of function ‘symbols__delete’util/dso.c:435: error: nested extern declaration of ‘symbols__delete’util/dso.c: In function ‘dso__read_running_kernel_build_id’:util/dso.c:462: error: implicit declaration of function ‘sysfs__read_build_id’util/dso.c:462: error: nested extern declaration of ‘sysfs__read_build_id’util/dso.c: In function ‘__dsos__read_build_ids’:util/dso.c:500: error: implicit declaration of function ‘filename__read_build_id’util/dso.c:500: error: nested extern declaration of ‘filename__read_build_id’
Quoted 8 lines
util/dso.c: In function ‘dso__fprintf’:util/dso.c:589: error: dereferencing pointer to incomplete typeutil/dso.c:589: error: type defaults to ‘int’ in declaration of ‘__mptr’util/dso.c:589: error: initialization from incompatible pointer typeutil/dso.c:589: error: invalid use of undefined type ‘struct symbol’util/dso.c:590: error: implicit declaration of function ‘symbol__fprintf’util/dso.c:590: error: nested extern declaration of ‘symbol__fprintf’
make: *** [/home/acme/git/build/perf/util/dso.o] Error 1
ugh.. I have it rebased to your perf/core and it builds cleanly
Any chance there's something not pushed yet?
thanks,
jirka
Re: [PATCH 5/5] perf tool: Move dso_* related functions into dso object
Em Sun, Oct 28, 2012 at 07:42:01PM +0100, Jiri Olsa escreveu:
Quoted 30 lines · Arnaldo Carvalho de Melo
Quoted 20 lines
CC
/home/acme/git/build/perf/util/dso-test-data.o
In file included fromutil/dso.c:2:util/dso.h:87: error: ‘BUILD_ID_SIZE’ undeclared here (not in a function)
CC/home/acme/git/build/perf/util/color.o
cc1: warnings being treated as errorsutil/dso.c: In function ‘dso__binary_type_file’:util/dso.c:45: error: implicit declaration of function ‘filename__read_debuglink’util/dso.c:45: error: nested extern declaration of ‘filename__read_debuglink’util/dso.c:51: error: ‘symbol_conf’ undeclared (first use in this function)util/dso.c:51: error: (Each undeclared identifier is reported only onceutil/dso.c:51: error: for each function it appears in.)util/dso.c: In function ‘dso__delete’:util/dso.c:435: error: implicit declaration of function ‘symbols__delete’util/dso.c:435: error: nested extern declaration of ‘symbols__delete’util/dso.c: In function ‘dso__read_running_kernel_build_id’:util/dso.c:462: error: implicit declaration of function ‘sysfs__read_build_id’util/dso.c:462: error: nested extern declaration of ‘sysfs__read_build_id’util/dso.c: In function ‘__dsos__read_build_ids’:util/dso.c:500: error: implicit declaration of function ‘filename__read_build_id’util/dso.c:500: error: nested extern declaration of ‘filename__read_build_id’Quoted 8 lines
util/dso.c: In function ‘dso__fprintf’:util/dso.c:589: error: dereferencing pointer to incomplete typeutil/dso.c:589: error: type defaults to ‘int’ in declaration of ‘__mptr’util/dso.c:589: error: initialization from incompatible pointer typeutil/dso.c:589: error: invalid use of undefined type ‘struct symbol’util/dso.c:590: error: implicit declaration of function ‘symbol__fprintf’util/dso.c:590: error: nested extern declaration of ‘symbol__fprintf’
make: *** [/home/acme/git/build/perf/util/dso.o] Error 1
Quoted 3 lines
ugh.. I have it rebased to your perf/core and it builds cleanly
Any chance there's something not pushed yet?
The only thing besides the four first patches in your series is one that you acked:
commit 9175ce1f1244edd9f4d39605aa06ce5b0a50b8e0
Author: Andi Kleen <[email protected]> Date: Fri Oct 26 13:30:06 2012 -0700
perf tools: Move parse_events error printing to parse_events_options
---------------
[acme@sandy linux]$ cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.3 (Santiago)
- Arnaldo
[tip:perf/core] perf tools: Move dso_* related functions into dso object
In reply to Jiri OlsaCommit-ID: cdd059d731eeb466f51a404ee6cbfafb0fc7c20b Gitweb: http://git.kernel.org/tip/cdd059d731eeb466f51a404ee6cbfafb0fc7c20b Author: Jiri Olsa <[email protected]> AuthorDate: Sat, 27 Oct 2012 23:18:32 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 29 Oct 2012 11:37:25 -0200
perf tools: Move dso_* related functions into dso object
Moving dso_* related functions into dso object.
Keeping symbol loading related functions still in the symbol object as it seems more convenient.
--- tools/perf/Makefile | 2 + tools/perf/util/dso.c | 594 +++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/dso.h | 148 ++++++++++++ tools/perf/util/symbol.c | 599 +--------------------------------------------- tools/perf/util/symbol.h | 134 +---------- 5 files changed, 751 insertions(+), 726 deletions(-)
tools/perf/Makefile +2 -0
@@ -327,6 +327,7 @@ LIB_H += util/svghelper.h LIB_H += util/tool.h LIB_H += util/run-command.h LIB_H += util/sigchain.h +LIB_H += util/dso.h LIB_H += util/symbol.h LIB_H += util/color.h LIB_H += util/values.h
@@ -385,6 +386,7 @@ LIB_OBJS += $(OUTPUT)util/top.o LIB_OBJS += $(OUTPUT)util/usage.o LIB_OBJS += $(OUTPUT)util/wrapper.o LIB_OBJS += $(OUTPUT)util/sigchain.o +LIB_OBJS += $(OUTPUT)util/dso.o LIB_OBJS += $(OUTPUT)util/symbol.o LIB_OBJS += $(OUTPUT)util/symbol-elf.o LIB_OBJS += $(OUTPUT)util/dso-test-data.o
tools/perf/util/dso.c new file +594 -0
594 lines not on this page · raw message
tools/perf/util/dso.h new file +148 -0
148 lines not on this page · raw message
tools/perf/util/symbol.c +2 -597
674 lines not on this page · raw message
tools/perf/util/symbol.h +5 -129
185 lines not on this page · raw message
Namhyung Kim
maintainerHi Jiri,
Quoted 10 lines · Jiri Olsa
hi,
separating dso related stuff into dso object plus some other symbol object cleanup. It's just a code moving, no actual change was done.Attached patches:
1/5 perf tool: Movebuild_id__sprintfinto build-id object 2/5 perf tool: MoveBUILD_ID_SIZEinto build-id object 3/5 perf tool: Move hex2u64 into util object
4/5 perf tool: Move strxfrchar into string object 5/5 perf tool: Move dso_* related functions into dso object
Looks good to me.
Arnaldo, if you want, you can add my Reviewed- or Tested-by tags for this series.
Thanks,
Namhyung
Quoted 14 lines · Namhyung Kim
Hi Jiri,
Quoted 10 lines · Jiri Olsa
hi,
separating dso related stuff into dso object plus some other symbol object cleanup. It's just a code moving, no actual change was done.Attached patches:
1/5 perf tool: Movebuild_id__sprintfinto build-id object 2/5 perf tool: MoveBUILD_ID_SIZEinto build-id object 3/5 perf tool: Move hex2u64 into util object
4/5 perf tool: Move strxfrchar into string object 5/5 perf tool: Move dso_* related functions into dso object
Quoted 4 lines
Looks good to me.
Arnaldo, if you want, you can add my Reviewed- or Tested-by tags for this series.
humm, so you could compile it wth no problem..? what system are you? ;)
thanks,
jirka
Namhyung Kim
maintainerQuoted 15 lines · Jiri Olsa
Quoted 14 lines · Namhyung Kim
Hi Jiri,
Quoted 10 lines · Jiri Olsa
hi,
separating dso related stuff into dso object plus some other symbol object cleanup. It's just a code moving, no actual change was done.Attached patches:
1/5 perf tool: Movebuild_id__sprintfinto build-id object 2/5 perf tool: MoveBUILD_ID_SIZEinto build-id object 3/5 perf tool: Move hex2u64 into util object
4/5 perf tool: Move strxfrchar into string object 5/5 perf tool: Move dso_* related functions into dso object
Quoted 6 lines
Quoted 4 lines
Looks good to me.
Arnaldo, if you want, you can add my Reviewed- or Tested-by tags for this series.
humm, so you could compile it wth no problem..? what system are you? ;)
I just compiled your branch. :)
I'll check it again if you send out the v2.
Thanks,
Namhyung
Em Mon, Oct 29, 2012 at 12:13:28PM +0100, Jiri Olsa escreveu:
Quoted 6 lines · Namhyung Kim
Quoted 4 lines · Jiri Olsa
Quoted 3 lines
separating dso related stuff into dso object plus some other symbol object cleanup. It's just a code moving, no actual change was done.
Quoted 6 lines
Quoted 4 lines
Looks good to me.
Arnaldo, if you want, you can add my Reviewed- or Tested-by tags for this series.
humm, so you could compile it wth no problem..? what system are you? ;)
util/dso.c:1:20: error: symbol.h: No such file or directory
[acme@sandy linux]$ head -4 tools/perf/util/dso.c
#include <symbol.h>
#include "dso.h"
#include "util.h"
#include "debug.h"
[acme@sandy linux]$
If I use "symbol.h" it builds, I've fixed this one here, thanks.
The problem is that I use O=, building it without it works.
- ARnaldo