thread.c (598911b42c940158caa1169092a804903bde845e) thread.c (3178f58b989430fd0721df97bf21cf1c0e8cc419)
1#include "../perf.h"
2#include <stdlib.h>
3#include <stdio.h>
4#include <string.h>
5#include "session.h"
6#include "thread.h"
7#include "util.h"
8#include "debug.h"

--- 52 unchanged lines hidden (view full) ---

61
62 return list_first_entry(&thread->comm_list, struct comm, list);
63}
64
65/* CHECKME: time should always be 0 if event aren't ordered */
66int thread__set_comm(struct thread *thread, const char *str, u64 timestamp)
67{
68 struct comm *new, *curr = thread__comm(thread);
1#include "../perf.h"
2#include <stdlib.h>
3#include <stdio.h>
4#include <string.h>
5#include "session.h"
6#include "thread.h"
7#include "util.h"
8#include "debug.h"

--- 52 unchanged lines hidden (view full) ---

61
62 return list_first_entry(&thread->comm_list, struct comm, list);
63}
64
65/* CHECKME: time should always be 0 if event aren't ordered */
66int thread__set_comm(struct thread *thread, const char *str, u64 timestamp)
67{
68 struct comm *new, *curr = thread__comm(thread);
69 int err;
69
70 /* Override latest entry if it had no specific time coverage */
71 if (!curr->start) {
70
71 /* Override latest entry if it had no specific time coverage */
72 if (!curr->start) {
72 comm__override(curr, str, timestamp);
73 err = comm__override(curr, str, timestamp);
74 if (err)
75 return err;
73 } else {
74 new = comm__new(str, timestamp);
75 if (!new)
76 return -ENOMEM;
77 list_add(&new->list, &thread->comm_list);
78 }
79
80 thread->comm_set = true;

--- 40 unchanged lines hidden (view full) ---

121{
122 int i, err;
123
124 if (parent->comm_set) {
125 const char *comm = thread__comm_str(parent);
126 if (!comm)
127 return -ENOMEM;
128 err = thread__set_comm(thread, comm, timestamp);
76 } else {
77 new = comm__new(str, timestamp);
78 if (!new)
79 return -ENOMEM;
80 list_add(&new->list, &thread->comm_list);
81 }
82
83 thread->comm_set = true;

--- 40 unchanged lines hidden (view full) ---

124{
125 int i, err;
126
127 if (parent->comm_set) {
128 const char *comm = thread__comm_str(parent);
129 if (!comm)
130 return -ENOMEM;
131 err = thread__set_comm(thread, comm, timestamp);
129 if (!err)
132 if (err)
130 return err;
131 thread->comm_set = true;
132 }
133
134 for (i = 0; i < MAP__NR_TYPES; ++i)
135 if (map_groups__clone(&thread->mg, &parent->mg, i) < 0)
136 return -ENOMEM;
137
138 thread->ppid = parent->tid;
139
140 return 0;
141}
133 return err;
134 thread->comm_set = true;
135 }
136
137 for (i = 0; i < MAP__NR_TYPES; ++i)
138 if (map_groups__clone(&thread->mg, &parent->mg, i) < 0)
139 return -ENOMEM;
140
141 thread->ppid = parent->tid;
142
143 return 0;
144}