Merge tag 'powerpc-5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux/fpc-iii.git] / tools / perf / trace / beauty / pid.c
blob1a6acc46807bca7e73f395c37e62a50ed8290773
1 // SPDX-License-Identifier: LGPL-2.1
3 size_t syscall_arg__scnprintf_pid(char *bf, size_t size, struct syscall_arg *arg)
5 int pid = arg->val;
6 struct trace *trace = arg->trace;
7 size_t printed = scnprintf(bf, size, "%d", pid);
8 struct thread *thread = machine__findnew_thread(trace->host, pid, pid);
10 if (thread != NULL) {
11 if (!thread->comm_set)
12 thread__set_comm_from_proc(thread);
14 if (thread->comm_set)
15 printed += scnprintf(bf + printed, size - printed,
16 " (%s)", thread__comm_str(thread));
17 thread__put(thread);
20 return printed;