Working on -e trace

Dmitry V. Levin ldv at altlinux.org
Wed Mar 9 02:55:03 UTC 2016


On Tue, Mar 08, 2016 at 10:05:15PM +0530, haris iqbal wrote:
> On Tue, Mar 8, 2016 at 4:02 AM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> > On Mon, Mar 07, 2016 at 02:35:50PM +0530, haris iqbal wrote:
> >> 2016-03-07 Md Haris Iqbal <haris.phnx at gmail.com>
> >>
> >> * defs.h
> >> * + define TRACE_SCHED 04000 / Trace scheduler-related syscalls /
> >>
> >> * syscall.c (lookup_class)
> >> * +    if (strcmp(s, "scheduler") == 0)
> >> * +        return TRACE_SCHED;
> >> * + define TSC TRACE_SCHED
> >>
> >> * All syscallent.h files
> >> * added TSC flag
> >>
> >> Tested with -e trace=scheduler
> >
> > Sorry, but what does this mean?  It surely doesn't look like a patch.
> 
> Sorry, My mistake. Here it is.
> 
> commit 5203b9e6512a9c8a77faa63669b1899d247e1059
> Author: student <haris.phnx at gmail.com>
> Date:   Mon Mar 7 14:18:12 2016 +0530
> 
>     Added feature to trace the scheduler group with -e option
> 
> diff --git a/defs.h b/defs.h
> index f095ff6..6c840f5 100644
> --- a/defs.h
> +++ b/defs.h
> @@ -403,6 +403,7 @@ extern const struct xlat whence_codes[];
>  #define TRACE_SIGNAL    020    /* Trace signal-related syscalls. */
>  #define TRACE_DESC    040    /* Trace file descriptor-related syscalls. */
>  #define TRACE_MEMORY    0100    /* Trace memory mapping-related syscalls. */
> +#define TRACE_SCHED 04000       /* Trace scheduler-related syscalls */

Is there any reason to insert a new value in the middle of the list?
Let's keep the list in order.
Also, please follow the indentation style.

>  #define SYSCALL_NEVER_FAILS    0200    /* Syscall is always successful. */
>  #define STACKTRACE_INVALIDATE_CACHE 0400  /* Trigger proc/maps cache
> updating */
>  #define STACKTRACE_CAPTURE_ON_ENTER 01000 /* Capture stacktrace on
> "entering" stage */
> diff --git a/linux/32/syscallent.h b/linux/32/syscallent.h
> index 03874ac..096bd32 100644
> --- a/linux/32/syscallent.h
> +++ b/linux/32/syscallent.h
> @@ -123,16 +123,16 @@
>  [115] = { 4,    0,        SEN(clock_nanosleep),        "clock_nanosleep"    },
>  [116] = { 3,    0,        SEN(syslog),            "syslog"        },
>  [117] = { 4,    0,        SEN(ptrace),            "ptrace"        },
> -[118] = { 2,    0,        SEN(sched_setparam),        "sched_setparam"    },
> -[119] = { 3,    0,        SEN(sched_setscheduler),
> "sched_setscheduler"    },
> -[120] = { 1,    0,        SEN(sched_getscheduler),
> "sched_getscheduler"    },
> -[121] = { 2,    0,        SEN(sched_getparam),        "sched_getparam"    },
> -[122] = { 3,    0,        SEN(sched_setaffinity),
> "sched_setaffinity"    },
> -[123] = { 3,    0,        SEN(sched_getaffinity),
> "sched_getaffinity"    },
> -[124] = { 0,    0,        SEN(sched_yield),        "sched_yield"        },
> -[125] = { 1,    0,        SEN(sched_get_priority_max),
> "sched_get_priority_max"},
> -[126] = { 1,    0,        SEN(sched_get_priority_min),
> "sched_get_priority_min"},
> -[127] = { 2,    0,        SEN(sched_rr_get_interval),
> "sched_rr_get_interval"    },
> +[118] = { 2,    TSC,        SEN(sched_setparam),        "sched_setparam"    },
> +[119] = { 3,    TSC,        SEN(sched_setscheduler),
> "sched_setscheduler"    },
> +[120] = { 1,    TSC,        SEN(sched_getscheduler),
> "sched_getscheduler"    },
> +[121] = { 2,    TSC,        SEN(sched_getparam),        "sched_getparam"    },
> +[122] = { 3,    TSC,        SEN(sched_setaffinity),
> "sched_setaffinity"    },
> +[123] = { 3,    TSC,        SEN(sched_getaffinity),
> "sched_getaffinity"    },
> +[124] = { 0,    TSC,        SEN(sched_yield),        "sched_yield"        },
> +[125] = { 1,    TSC,        SEN(sched_get_priority_max),
> "sched_get_priority_max"},
> +[126] = { 1,    TSC,        SEN(sched_get_priority_min),
> "sched_get_priority_min"},
> +[127] = { 2,    TSC,        SEN(sched_rr_get_interval),
> "sched_rr_get_interval"    },
>  [128] = { 0,    0,        SEN(restart_syscall),        "restart_syscall"    },
>  [129] = { 2,    TS,        SEN(kill),            "kill"            },
>  [130] = { 2,    TS,        SEN(kill),            "tkill"            },
> @@ -264,8 +264,8 @@
>  [271] = { 6,    0,        SEN(process_vm_writev),
> "process_vm_writev"    },
>  [272] = { 5,    0,        SEN(kcmp),            "kcmp"            },
>  [273] = { 3,    TD,        SEN(finit_module),        "finit_module"        },
> -[274] = { 3,    0,        SEN(sched_setattr),        "sched_setattr"        },
> -[275] = { 4,    0,        SEN(sched_getattr),        "sched_getattr"        },
> +[274] = { 3,    TSC,        SEN(sched_setattr),
> "sched_setattr"        },
> +[275] = { 4,    TSC,        SEN(sched_getattr),
> "sched_getattr"        },
>  [276] = { 5,    TD|TF,        SEN(renameat2),            "renameat2"        },
>  [277] = { 3,    0,        SEN(seccomp),            "seccomp",        },
>  [278] = { 3,    0,        SEN(getrandom),            "getrandom",        },

I assume all changes to syscallent files were made by some simple script.
Please include this script into commit message.

[...]
> --- a/syscall.c
> +++ b/syscall.c
> @@ -78,6 +78,7 @@
>  #define TP TRACE_PROCESS
>  #define TS TRACE_SIGNAL
>  #define TM TRACE_MEMORY
> +#define TSC TRACE_SCHED
>  #define NF SYSCALL_NEVER_FAILS
>  #define MA MAX_ARGS
>  #define SI STACKTRACE_INVALIDATE_CACHE
> @@ -500,6 +501,8 @@ lookup_class(const char *s)
>          return TRACE_DESC;
>      if (strcmp(s, "memory") == 0)
>          return TRACE_MEMORY;
> +    if (strcmp(s, "scheduler") == 0)
> +        return TRACE_SCHED;
>      return -1;
>  }

Please follow the indentation style.
BTW, why "scheduler"?  Could you give a rationale for this name?


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160309/69cf0733/attachment.bin>


More information about the Strace-devel mailing list