// time operation
int trace_entry(struct pt_regs *ctx)
{
- u32 pid = bpf_get_current_pid_tgid();
+ u64 pid_tgid = bpf_get_current_pid_tgid();
+ u32 pid = pid_tgid >> 32;
+ u32 tid = (u32)pid_tgid;
+
if (FILTER_PID)
return 0;
u64 ts = bpf_ktime_get_ns();
- start.update(&pid, &ts);
+ start.update(&tid, &ts);
return 0;
}
// I do by checking file->f_op.
int trace_read_entry(struct pt_regs *ctx, struct kiocb *iocb)
{
- u32 pid = bpf_get_current_pid_tgid();
+ u64 pid_tgid = bpf_get_current_pid_tgid();
+ u32 pid = pid_tgid >> 32;
+ u32 tid = (u32)pid_tgid;
+
if (FILTER_PID)
return 0;
return 0;
u64 ts = bpf_ktime_get_ns();
- start.update(&pid, &ts);
+ start.update(&tid, &ts);
return 0;
}
int trace_open_entry(struct pt_regs *ctx, struct inode *inode,
struct file *file)
{
- u32 pid;
- pid = bpf_get_current_pid_tgid();
+ u64 pid_tgid = bpf_get_current_pid_tgid();
+ u32 pid = pid_tgid >> 32;
+ u32 tid = (u32)pid_tgid;
+
if (FILTER_PID)
return 0;
return 0;
u64 ts = bpf_ktime_get_ns();
- start.update(&pid, &ts);
+ start.update(&tid, &ts);
return 0;
}
static int trace_return(struct pt_regs *ctx, const char *op)
{
u64 *tsp;
- u32 pid = bpf_get_current_pid_tgid();
+ u64 pid_tgid = bpf_get_current_pid_tgid();
+ u32 pid = pid_tgid >> 32;
+ u32 tid = (u32)pid_tgid;
// fetch timestamp and calculate delta
- tsp = start.lookup(&pid);
+ tsp = start.lookup(&tid);
if (tsp == 0) {
return 0; // missed start or filtered
}
__builtin_memcpy(&key.op, op, sizeof(key.op));
dist.increment(key);
- start.delete(&pid);
+ start.delete(&tid);
return 0;
}
// time operation
int trace_entry(struct pt_regs *ctx)
{
- u32 pid = bpf_get_current_pid_tgid();
+ u64 pid_tgid = bpf_get_current_pid_tgid();
+ u32 pid = pid_tgid >> 32;
+ u32 tid = (u32)pid_tgid;
+
if (FILTER_PID)
return 0;
u64 ts = bpf_ktime_get_ns();
- start.update(&pid, &ts);
+ start.update(&tid, &ts);
return 0;
}
static int trace_return(struct pt_regs *ctx, const char *op)
{
u64 *tsp;
- u32 pid = bpf_get_current_pid_tgid();
+ u64 pid_tgid = bpf_get_current_pid_tgid();
+ u32 pid = pid_tgid >> 32;
+ u32 tid = (u32)pid_tgid;
// fetch timestamp and calculate delta
- tsp = start.lookup(&pid);
+ tsp = start.lookup(&tid);
if (tsp == 0) {
return 0; // missed start or filtered
}
u64 delta = bpf_ktime_get_ns() - *tsp;
- start.delete(&pid);
+ start.delete(&tid);
// Skip entries with backwards time: temp workaround for #728
if ((s64) delta < 0)
ext4_trace_read_code = """
int trace_read_entry(struct pt_regs *ctx, struct kiocb *iocb)
{
- u32 pid = bpf_get_current_pid_tgid();
+ u64 pid_tgid = bpf_get_current_pid_tgid();
+ u32 pid = pid_tgid >> 32;
+ u32 tid = (u32)pid_tgid;
+
if (FILTER_PID)
return 0;
return 0;
u64 ts = bpf_ktime_get_ns();
- start.update(&pid, &ts);
+ start.update(&tid, &ts);
return 0;
}""" % ext4_file_ops_addr
// time operation
int trace_entry(struct pt_regs *ctx)
{
- u32 pid = bpf_get_current_pid_tgid();
+ u64 pid_tgid = bpf_get_current_pid_tgid();
+ u32 pid = pid_tgid >> 32;
+ u32 tid = (u32)pid_tgid;
+
if (FILTER_PID)
return 0;
u64 ts = bpf_ktime_get_ns();
- start.update(&pid, &ts);
+ start.update(&tid, &ts);
return 0;
}
static int trace_return(struct pt_regs *ctx, const char *op)
{
u64 *tsp;
- u32 pid = bpf_get_current_pid_tgid();
+ u64 pid_tgid = bpf_get_current_pid_tgid();
+ u32 pid = pid_tgid >> 32;
+ u32 tid = (u32)pid_tgid;
// fetch timestamp and calculate delta
- tsp = start.lookup(&pid);
+ tsp = start.lookup(&tid);
if (tsp == 0) {
return 0; // missed start or filtered
}
__builtin_memcpy(&key.op, op, sizeof(key.op));
dist.increment(key);
- start.delete(&pid);
+ start.delete(&tid);
return 0;
}
// time operation
int trace_entry(struct pt_regs *ctx)
{
- u32 pid = bpf_get_current_pid_tgid();
+ u64 pid_tgid = bpf_get_current_pid_tgid();
+ u32 pid = pid_tgid >> 32;
+ u32 tid = (u32)pid_tgid;
+
if (FILTER_PID)
return 0;
u64 ts = bpf_ktime_get_ns();
- start.update(&pid, &ts);
+ start.update(&tid, &ts);
return 0;
}
static int trace_return(struct pt_regs *ctx, const char *op)
{
u64 *tsp;
- u32 pid = bpf_get_current_pid_tgid();
+ u64 pid_tgid = bpf_get_current_pid_tgid();
+ u32 pid = pid_tgid >> 32;
+ u32 tid = (u32)pid_tgid;
// fetch timestamp and calculate delta
- tsp = start.lookup(&pid);
+ tsp = start.lookup(&tid);
if (tsp == 0) {
return 0; // missed start or filtered
}
__builtin_memcpy(&key.op, op, sizeof(key.op));
dist.increment(key);
- start.delete(&pid);
+ start.delete(&tid);
return 0;
}
// time operation
int trace_entry(struct pt_regs *ctx)
{
- u32 pid = bpf_get_current_pid_tgid();
+ u64 pid_tgid = bpf_get_current_pid_tgid();
+ u32 pid = pid_tgid >> 32;
+ u32 tid = (u32)pid_tgid;
+
if (FILTER_PID)
return 0;
u64 ts = bpf_ktime_get_ns();
- start.update(&pid, &ts);
+ start.update(&tid, &ts);
return 0;
}
static int trace_return(struct pt_regs *ctx, const char *op)
{
u64 *tsp;
- u32 pid = bpf_get_current_pid_tgid();
+ u64 pid_tgid = bpf_get_current_pid_tgid();
+ u32 pid = pid_tgid >> 32;
+ u32 tid = (u32)pid_tgid;
// fetch timestamp and calculate delta
- tsp = start.lookup(&pid);
+ tsp = start.lookup(&tid);
if (tsp == 0) {
return 0; // missed start or filtered
}
__builtin_memcpy(&key.op, op, sizeof(key.op));
dist.increment(key);
- start.delete(&pid);
+ start.delete(&tid);
return 0;
}