Linux Perf
pid.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0
2 size_t syscall_arg__scnprintf_pid(char *bf, size_t size, struct syscall_arg *arg)
3 {
4  int pid = arg->val;
5  struct trace *trace = arg->trace;
6  size_t printed = scnprintf(bf, size, "%d", pid);
7  struct thread *thread = machine__findnew_thread(trace->host, pid, pid);
8 
9  if (thread != NULL) {
10  if (!thread->comm_set)
12 
13  if (thread->comm_set)
14  printed += scnprintf(bf + printed, size - printed,
15  " (%s)", thread__comm_str(thread));
16  thread__put(thread);
17  }
18 
19  return printed;
20 }
size_t size
Definition: evsel.c:60
struct machine * host
Definition: builtin-trace.c:85
bool comm_set
Definition: thread.h:29
struct trace * trace
Definition: beauty.h:47
Definition: thread.h:18
const char * thread__comm_str(const struct thread *thread)
Definition: thread.c:258
int thread__set_comm_from_proc(struct thread *thread)
Definition: thread.c:231
size_t syscall_arg__scnprintf_pid(char *bf, size_t size, struct syscall_arg *arg)
Definition: pid.c:2
u32 pid
Definition: hists_common.c:15
void thread__put(struct thread *thread)
Definition: thread.c:119
unsigned long val
Definition: beauty.h:44
struct thread * machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid)
Definition: machine.c:492