Working on -e trace

haris iqbal haris.phnx at gmail.com
Wed Mar 9 05:32:52 UTC 2016


commit 6a059d82bc833cb5a221e4d4cf7d5bb09a94fe60
Author: student <haris.phnx at gmail.com>
Date:   Wed Mar 9 10:47:03 2016 +0530

    Corrected indentation and change the sequence of new value inserted

diff --git a/defs.h b/defs.h
index 564075e..531fc9d 100644
--- a/defs.h
+++ b/defs.h
@@ -396,7 +396,7 @@ extern const struct xlat whence_codes[];

 #define RVAL_DECODED    0100    /* syscall decoding finished */

-#define TRACE_FILE    001 /* Trace file-related syscalls. */
+#define TRACE_FILE    001    /* Trace file-related syscalls. */
 #define TRACE_IPC    002    /* Trace IPC-related syscalls. */
 #define TRACE_NETWORK    004    /* Trace network-related syscalls. */
 #define TRACE_PROCESS    010    /* Trace process-related syscalls. */

commit e7b8dbce19b48e372df03564be9121ae685282d1
Author: student <haris.phnx at gmail.com>
Date:   Wed Mar 9 10:36:44 2016 +0530

    Corrected indentation and change the sequence of new value inserted

diff --git a/defs.h b/defs.h
index 9e15dde..564075e 100644
--- a/defs.h
+++ b/defs.h
@@ -407,7 +407,7 @@ extern const struct xlat whence_codes[];
 #define STACKTRACE_INVALIDATE_CACHE 0400  /* Trigger proc/maps cache
updating */
 #define STACKTRACE_CAPTURE_ON_ENTER 01000 /* Capture stacktrace on
"entering" stage */
 #define TRACE_INDIRECT_SUBCALL    02000    /* Syscall is an indirect
socket/ipc subcall. */
-#define    TRACE_SCHED    04000    /* Trace scheduler-related syscalls */
+#define TRACE_SCHED    04000    /* Trace scheduler-related syscalls */

 #define IOCTL_NUMBER_UNKNOWN 0
 #define IOCTL_NUMBER_HANDLED 1

commit cd5a305e9ba7b38c5a9644ab4c42224516e44b3c
Author: student <haris.phnx at gmail.com>
Date:   Wed Mar 9 10:32:54 2016 +0530

    Corrected indentation and change the sequence of new value inserted

diff --git a/defs.h b/defs.h
index 6c840f5..9e15dde 100644
--- a/defs.h
+++ b/defs.h
@@ -396,18 +396,18 @@ extern const struct xlat whence_codes[];

 #define RVAL_DECODED    0100    /* syscall decoding finished */

-#define TRACE_FILE    001    /* Trace file-related syscalls. */
+#define TRACE_FILE    001 /* Trace file-related syscalls. */
 #define TRACE_IPC    002    /* Trace IPC-related syscalls. */
 #define TRACE_NETWORK    004    /* Trace network-related syscalls. */
 #define TRACE_PROCESS    010    /* Trace process-related syscalls. */
 #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 */
 #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 */
 #define TRACE_INDIRECT_SUBCALL    02000    /* Syscall is an indirect
socket/ipc subcall. */
+#define    TRACE_SCHED    04000    /* Trace scheduler-related syscalls */

 #define IOCTL_NUMBER_UNKNOWN 0
 #define IOCTL_NUMBER_HANDLED 1
diff --git a/syscall.c b/syscall.c
index 7184dbf..30d036a 100644
--- a/syscall.c
+++ b/syscall.c
@@ -501,8 +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;
+    if (strcmp(s, "scheduler") == 0)
+        return TRACE_SCHED;
     return -1;
 }

Sorry for the multiple commits. My vim is giving trouble.


On Wed, Mar 9, 2016 at 8:25 AM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> 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.

The python script that I used was


import os
rootdir = '/home/student/junk/test_strace'

seperator = ','
for subdir, dirs, files in os.walk(rootdir):
    for file in files:
        temp = os.path.join(subdir, file)
        if(temp.find("syscallent") != -1):
            print
"------------------------------------------------------------------\n"
            print temp

            with open(temp, 'r') as file:
                lines = file.readlines()

            for i in range(len(lines)):
                if(lines[i].find("sched") != -1):
                    print lines[i]
                    parts = lines[i].split(seperator)

                    parts[1] = '\tTSC'

                    lines[i] = seperator.join(parts)
                    print lines[i]


            with open(temp, 'w') as file:
                file.writelines( lines )



>
> [...]
>> --- 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?

I thought as all the system calls are one or the other related to the
scheduler. We can also consider the description "syscalls relate to
scheduling.

>
>
> --
> ldv
>
> ------------------------------------------------------------------------------
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
> _______________________________________________
> Strace-devel mailing list
> Strace-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/strace-devel
>



-- 

With regards,

Md Haris Iqbal,
Placement Coordinator, MTech IT
NITK Surathkal,
Contact: +91 8861996962




More information about the Strace-devel mailing list