aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/util/thread-stack.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/tools/perf/util/thread-stack.c b/tools/perf/util/thread-stack.c
index a5f7b9d8fc23..03770af9e5cd 100644
--- a/tools/perf/util/thread-stack.c
+++ b/tools/perf/util/thread-stack.c
@@ -93,6 +93,24 @@ static int thread_stack__grow(struct thread_stack *ts)
93 return 0; 93 return 0;
94} 94}
95 95
96static int thread_stack__init(struct thread_stack *ts, struct thread *thread,
97 struct call_return_processor *crp)
98{
99 int err;
100
101 err = thread_stack__grow(ts);
102 if (err)
103 return err;
104
105 if (thread->mg && thread->mg->machine)
106 ts->kernel_start = machine__kernel_start(thread->mg->machine);
107 else
108 ts->kernel_start = 1ULL << 63;
109 ts->crp = crp;
110
111 return 0;
112}
113
96static struct thread_stack *thread_stack__new(struct thread *thread, 114static struct thread_stack *thread_stack__new(struct thread *thread,
97 struct call_return_processor *crp) 115 struct call_return_processor *crp)
98{ 116{
@@ -104,17 +122,11 @@ static struct thread_stack *thread_stack__new(struct thread *thread,
104 122
105 ts->arr_sz = 1; 123 ts->arr_sz = 1;
106 124
107 if (thread_stack__grow(ts)) { 125 if (thread_stack__init(ts, thread, crp)) {
108 free(ts); 126 free(ts);
109 return NULL; 127 return NULL;
110 } 128 }
111 129
112 if (thread->mg && thread->mg->machine)
113 ts->kernel_start = machine__kernel_start(thread->mg->machine);
114 else
115 ts->kernel_start = 1ULL << 63;
116 ts->crp = crp;
117
118 thread->ts = ts; 130 thread->ts = ts;
119 131
120 return ts; 132 return ts;