Skip to content

Commit ebb296c

Browse files
Jiri Olsaacmel
authored andcommitted
perf tools: Move build_id__sprintf into build-id object
Moving build_id__sprintf function into build-id object. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Namhyung Kim <namhyung@kernel.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1351372712-21104-2-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 9175ce1 commit ebb296c

7 files changed

Lines changed: 19 additions & 17 deletions

File tree

‎tools/perf/builtin-buildid-cache.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "util/header.h"
1414
#include "util/parse-options.h"
1515
#include "util/strlist.h"
16-
#include "util/symbol.h"
16+
#include "util/build-id.h"
1717

1818
static int build_id_cache__add_file(const char *filename, const char *debugdir)
1919
{

‎tools/perf/util/build-id.c‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,21 @@ struct perf_tool build_id__mark_dso_hit_ops = {
7070
.build_id = perf_event__process_build_id,
7171
};
7272

73+
int build_id__sprintf(const u8 *build_id, int len, char *bf)
74+
{
75+
char *bid = bf;
76+
const u8 *raw = build_id;
77+
int i;
78+
79+
for (i = 0; i < len; ++i) {
80+
sprintf(bid, "%02x", *raw);
81+
++raw;
82+
bid += 2;
83+
}
84+
85+
return raw - build_id;
86+
}
87+
7388
char *dso__build_id_filename(struct dso *self, char *bf, size_t size)
7489
{
7590
char build_id_hex[BUILD_ID_SIZE * 2 + 1];

‎tools/perf/util/build-id.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
extern struct perf_tool build_id__mark_dso_hit_ops;
77

8+
int build_id__sprintf(const u8 *build_id, int len, char *bf);
89
char *dso__build_id_filename(struct dso *self, char *bf, size_t size);
910

1011
int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event,

‎tools/perf/util/header.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "pmu.h"
2424
#include "vdso.h"
2525
#include "strbuf.h"
26+
#include "build-id.h"
2627

2728
static bool no_buildid_cache = false;
2829

‎tools/perf/util/map.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "thread.h"
1111
#include "strlist.h"
1212
#include "vdso.h"
13+
#include "build-id.h"
1314

1415
const char *map_type__name[MAP__NR_TYPES] = {
1516
[MAP__FUNCTION] = "Functions",

‎tools/perf/util/symbol.c‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -504,21 +504,6 @@ void dso__sort_by_name(struct dso *dso, enum map_type type)
504504
&dso->symbols[type]);
505505
}
506506

507-
int build_id__sprintf(const u8 *build_id, int len, char *bf)
508-
{
509-
char *bid = bf;
510-
const u8 *raw = build_id;
511-
int i;
512-
513-
for (i = 0; i < len; ++i) {
514-
sprintf(bid, "%02x", *raw);
515-
++raw;
516-
bid += 2;
517-
}
518-
519-
return raw - build_id;
520-
}
521-
522507
size_t dso__fprintf_buildid(struct dso *dso, FILE *fp)
523508
{
524509
char sbuild_id[BUILD_ID_SIZE * 2 + 1];

‎tools/perf/util/symbol.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,
338338
int filename__read_build_id(const char *filename, void *bf, size_t size);
339339
int sysfs__read_build_id(const char *filename, void *bf, size_t size);
340340
bool __dsos__read_build_ids(struct list_head *head, bool with_hits);
341-
int build_id__sprintf(const u8 *build_id, int len, char *bf);
342341
int kallsyms__parse(const char *filename, void *arg,
343342
int (*process_symbol)(void *arg, const char *name,
344343
char type, u64 start));

0 commit comments

Comments
 (0)