Skip to content

Commit 2d47338

Browse files
committed
perf trace beauty: Export function to get the files for a thread
So that beautifiers can access things like dev_maj. Cc: Adrian Hunter <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Luis Cláudio Gonçalves <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Wang Nan <[email protected]> Link: https://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 86cf4c6 commit 2d47338

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

tools/perf/builtin-trace.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -958,11 +958,6 @@ static size_t fprintf_duration(unsigned long t, bool calculated, FILE *fp)
958958
return printed + fprintf(fp, "): ");
959959
}
960960

961-
struct file {
962-
char *pathname;
963-
int dev_maj;
964-
};
965-
966961
/**
967962
* filename.ptr: The filename char pointer that will be vfs_getname'd
968963
* filename.entry_str_pos: Where to insert the string translated from
@@ -1064,6 +1059,11 @@ static struct file *thread_trace__files_entry(struct thread_trace *ttrace, int f
10641059
return ttrace->files.table + fd;
10651060
}
10661061

1062+
struct file *thread__files_entry(struct thread *thread, int fd)
1063+
{
1064+
return thread_trace__files_entry(thread__priv(thread), fd);
1065+
}
1066+
10671067
static int trace__set_fd_pathname(struct thread *thread, int fd, const char *pathname)
10681068
{
10691069
struct thread_trace *ttrace = thread__priv(thread);

tools/perf/trace/beauty/beauty.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ size_t strarray__scnprintf_flags(struct strarray *sa, char *bf, size_t size, boo
3232
struct trace;
3333
struct thread;
3434

35+
struct file {
36+
char *pathname;
37+
int dev_maj;
38+
};
39+
40+
struct file *thread__files_entry(struct thread *thread, int fd);
41+
3542
struct strarrays {
3643
int nr_entries;
3744
struct strarray **entries;

0 commit comments

Comments
 (0)