Skip to contentSkip to conversation

perf: thread is its own parent

DISCUSSION David Ahern 2 participants 4 messages Mar 18, 2015 – Mar 19, 2015

lore
Share & tools
lore
#0 lore raw

Don:

In this commit:

commit 363b785f3805a2632eb09a8b430842461c21a640

Author: Don Zickus <[email protected]>
Date:   Fri Mar 14 10:43:44 2014 -0400

perf tools: Speed up thread map generation

you made a thread its own parent when synthesizing fork events:

static int perf_event__synthesize_fork(struct perf_tool *tool,
union perf_event *event, pid_t pid, pid_t tgid,
perf_event__handler_t process,
struct machine *machine)

{
        memset(&event->fork, 0, sizeof(event->fork) + 

machine->id_hdr_size);

        event->fork.ppid = tgid;
        event->fork.ptid = tgid;
        event->fork.pid  = tgid;
        event->fork.tid  = pid;
        event->fork.header.type = PERF_RECORD_FORK;

Any particular reason or just an oversight?

David

#1 lore raw
Quoted 21 lines · David Ahern

Don:

In this commit:

commit 363b785f3805a2632eb09a8b430842461c21a640

Author: Don Zickus <[email protected]>
Date:   Fri Mar 14 10:43:44 2014 -0400

perf tools: Speed up thread map generation

you made a thread its own parent when synthesizing fork events:

static int perf_event__synthesize_fork(struct perf_tool *tool,
union perf_event *event, pid_t pid, pid_t tgid,
perf_event__handler_t process,
struct machine *machine)

{
        memset(&event->fork, 0, sizeof(event->fork) +

machine->id_hdr_size);

Quoted 8 lines
        event->fork.ppid = tgid;
        event->fork.ptid = tgid;
        event->fork.pid  = tgid;
        event->fork.tid  = pid;
        event->fork.header.type = PERF_RECORD_FORK;

Any particular reason or just an oversight?

Hi David,

Honestly I don't recall. The commit log tells you the problem I was trying
to solve. Instead of parsing text strings from /proc/maps/<pid>, I believe it was waaaay faster to copy the thread maps.

This could have been an oversight. I might have falsely assumed tgid == ppid?

Are you finding a problem with it?

Cheers,
Don

#2 lore raw
Quoted 8 lines · Don Zickus

Honestly I don't recall. The commit log tells you the problem I was trying
to solve. Instead of parsing text strings from/proc/maps/<pid>, I believe it was waaaay faster to copy the thread maps.

This could have been an oversight. I might have falsely assumed tgid == ppid?

Are you finding a problem with it?

rebasing my scheduling timehist command to 4.0 and this change breaks one of the options. If there are no objections I'll send a patch along with others to set ptid and ppid to -1 (that's what it is in 3.12).

Thanks,
David

#3 lore raw
Quoted 8 lines · David Ahern
Quoted 7 lines · Don Zickus

Honestly I don't recall. The commit log tells you the problem I was trying
to solve. Instead of parsing text strings from/proc/maps/<pid>, I believe it was waaaay faster to copy the thread maps.

This could have been an oversight. I might have falsely assumed tgid == ppid?

Quoted 7 lines
Quoted 1 line

Are you finding a problem with it?

rebasing my scheduling timehist command to 4.0 and this change breaks one of the options. If there are no objections I'll send a patch along with others to set ptid and ppid to -1 (that's what it is in 3.12).

Hmm, I wonder if this is going to break our threading example. Perhaps not, now that Jiri made some other changes later. Feel free to post a patch, cc me please. I will patch our perf over here and have Joe Mario run some tests to see if we lose any data or not and let you know.

Cheers,
Don