2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
/*
* Copyright ( c ) 1991 , 1992 Paul Kranenburg < pk @ cs . few . eur . nl >
* Copyright ( c ) 1993 Branko Lankester < branko @ hacktic . nl >
* Copyright ( c ) 1993 , 1994 , 1995 , 1996 Rick Sladkey < jrs @ world . std . com >
* Copyright ( c ) 1996 - 1999 Wichert Akkerman < wichert @ cistron . nl >
* Copyright ( c ) 1999 IBM Deutschland Entwicklung GmbH , IBM Corporation
* Linux for s390 port by D . J . Barrow
* < barrow_dj @ mail . yahoo . com , djbarrow @ de . ibm . com >
* Copyright ( c ) 2004 Roland McGrath < roland @ redhat . com >
* Copyright ( c ) 2006 Dmitry V . Levin < ldv @ altlinux . org >
2018-02-13 22:00:00 +00:00
* Copyright ( c ) 2006 - 2018 The strace developers .
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
* All rights reserved .
*
* Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions
* are met :
* 1. Redistributions of source code must retain the above copyright
* notice , this list of conditions and the following disclaimer .
* 2. Redistributions in binary form must reproduce the above copyright
* notice , this list of conditions and the following disclaimer in the
* documentation and / or other materials provided with the distribution .
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission .
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` ` AS IS ' ' AND ANY EXPRESS OR
* IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED .
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT , INDIRECT ,
* INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT
* NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE ,
* DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT
* ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
*/
# include "defs.h"
2018-09-04 19:15:08 +02:00
# include <stdarg.h>
2013-03-07 12:27:40 +01:00
/* Per-syscall stats structure */
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
struct call_counts {
2014-05-28 17:52:40 +01:00
/* time may be total latency or system time */
Replace struct timeval with struct timespec in time measurements
This is required to implement more precise time measurements.
* Makefile.am (strace_LDADD): Add $(clock_LIBS).
* defs.h (struct tcb): Change the type of stime, dtime, and etime fields
from struct timeval to struct timespec, all users updated.
(syscall_exiting_decode, syscall_exiting_trace, count_syscall): Change
the type of "struct timeval *" argument to "struct timespec *", all
users updated.
(tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul): Rename to
ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul. Change
the type of all "struct timeval *" arguments to "struct timespec *",
all users updated.
* util.c (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul):
Rename to ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul.
Change the type of all "struct timeval *" arguments to "struct timespec *".
* count.c (struct call_counts): Change the type of "time" field
from struct timeval to struct timespec, all users updated.
(overhead): Change type from struct timeval to struct timespec, all
users updated.
(count_syscall): Change the type of "struct timeval *" argument to
"struct timespec *".
* strace.c (printleader): Change the type of struct timeval variables
to struct timespec, call clock_gettime instead of gettimeofday.
(next_event, trace_syscall): Change the type of struct timeval variables
to struct timespec.
* syscall.c (syscall_entering_finish, syscall_exiting_decode): Call
clock_gettime instead of gettimeofday.
2018-03-16 00:55:58 +00:00
struct timespec time ;
2018-09-04 20:36:08 +02:00
struct timespec time_min ;
struct timespec time_max ;
2018-09-04 19:15:08 +02:00
double time_avg ;
2018-01-05 03:18:13 +01:00
unsigned int calls , errors ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
} ;
static struct call_counts * countv [ SUPPORTED_PERSONALITIES ] ;
# define counts (countv[current_personality])
2018-09-02 22:07:07 +02:00
static const struct timespec zero_ts ;
2018-09-04 20:36:08 +02:00
static const struct timespec max_ts = {
( time_t ) ( long long ) ( zero_extend_signed_to_ull ( ~ ( ( ( time_t ) 0 ) ) ) > > 1 ) ,
LONG_MAX } ;
2018-09-02 22:07:07 +02:00
Replace struct timeval with struct timespec in time measurements
This is required to implement more precise time measurements.
* Makefile.am (strace_LDADD): Add $(clock_LIBS).
* defs.h (struct tcb): Change the type of stime, dtime, and etime fields
from struct timeval to struct timespec, all users updated.
(syscall_exiting_decode, syscall_exiting_trace, count_syscall): Change
the type of "struct timeval *" argument to "struct timespec *", all
users updated.
(tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul): Rename to
ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul. Change
the type of all "struct timeval *" arguments to "struct timespec *",
all users updated.
* util.c (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul):
Rename to ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul.
Change the type of all "struct timeval *" arguments to "struct timespec *".
* count.c (struct call_counts): Change the type of "time" field
from struct timeval to struct timespec, all users updated.
(overhead): Change type from struct timeval to struct timespec, all
users updated.
(count_syscall): Change the type of "struct timeval *" argument to
"struct timespec *".
* strace.c (printleader): Change the type of struct timeval variables
to struct timespec, call clock_gettime instead of gettimeofday.
(next_event, trace_syscall): Change the type of struct timeval variables
to struct timespec.
* syscall.c (syscall_entering_finish, syscall_exiting_decode): Call
clock_gettime instead of gettimeofday.
2018-03-16 00:55:58 +00:00
static struct timespec overhead ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
2018-09-04 19:15:08 +02:00
enum count_summary_columns {
CSC_NONE ,
CSC_TIME_100S ,
CSC_TIME_TOTAL ,
2018-09-04 20:36:08 +02:00
CSC_TIME_MIN ,
CSC_TIME_MAX ,
2018-09-04 19:15:08 +02:00
CSC_TIME_AVG ,
CSC_CALLS ,
CSC_ERRORS ,
CSC_SC_NAME ,
CSC_MAX ,
} ;
# define DEF_COLUMNS \
_ ( CSC_TIME_100S ) , \
_ ( CSC_TIME_TOTAL ) , \
_ ( CSC_TIME_AVG ) , \
_ ( CSC_CALLS ) , \
_ ( CSC_ERRORS ) , \
_ ( CSC_SC_NAME ) , \
/* End of DEF_COLUMNS definition */
# define _(x) x
static uint8_t columns [ CSC_MAX ] = { DEF_COLUMNS } ;
# undef _
# define _(x) [x] = 1
static uint8_t visible [ CSC_MAX ] = { DEF_COLUMNS } ;
# undef _
2011-08-21 17:47:40 +02:00
void
Replace struct timeval with struct timespec in time measurements
This is required to implement more precise time measurements.
* Makefile.am (strace_LDADD): Add $(clock_LIBS).
* defs.h (struct tcb): Change the type of stime, dtime, and etime fields
from struct timeval to struct timespec, all users updated.
(syscall_exiting_decode, syscall_exiting_trace, count_syscall): Change
the type of "struct timeval *" argument to "struct timespec *", all
users updated.
(tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul): Rename to
ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul. Change
the type of all "struct timeval *" arguments to "struct timespec *",
all users updated.
* util.c (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul):
Rename to ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul.
Change the type of all "struct timeval *" arguments to "struct timespec *".
* count.c (struct call_counts): Change the type of "time" field
from struct timeval to struct timespec, all users updated.
(overhead): Change type from struct timeval to struct timespec, all
users updated.
(count_syscall): Change the type of "struct timeval *" argument to
"struct timespec *".
* strace.c (printleader): Change the type of struct timeval variables
to struct timespec, call clock_gettime instead of gettimeofday.
(next_event, trace_syscall): Change the type of struct timeval variables
to struct timespec.
* syscall.c (syscall_entering_finish, syscall_exiting_decode): Call
clock_gettime instead of gettimeofday.
2018-03-16 00:55:58 +00:00
count_syscall ( struct tcb * tcp , const struct timespec * syscall_exiting_ts )
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
{
2016-12-18 17:12:27 +00:00
if ( ! scno_in_range ( tcp - > scno ) )
2011-08-21 17:47:40 +02:00
return ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
2018-09-04 20:36:08 +02:00
if ( ! counts ) {
Introduce memory allocation wrappers
Introduce wrappers to the following functions that do memory allocation:
malloc, calloc, realloc, strdup.
This commit is a follow-up to the related discussions in strace-devel ML:
http://sourceforge.net/p/strace/mailman/message/33618180/
http://sourceforge.net/p/strace/mailman/message/33733470/
* defs.h (xmalloc, xcalloc, xreallocarray, xstrdup): New prototypes.
* xmalloc.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* count.c (count_syscall, call_summary_pers): Use xcalloc.
* desc.c (decode_select): Use xmalloc.
* dirent.c (sys_getdents, sys_getdents64): Likewise.
* net.c (sys_recvmmsg): Use xstrdup.
* pathtrace.c (storepath): Use xreallocarray.
(pathtrace_match): Use xmalloc.
* strace.c (die_out_of_memory): Move to xmalloc.c.
(expand_tcbtab): Use xcalloc and xreallocarray.
(startup_child): Use xstrdup.
(init): Use xmalloc, xcalloc, and xstrdup.
* syscall.c (reallocate_qual): Use xreallocarray.
(qualify): Use xstrdup.
* unwind.c (unwind_tcb_init): Use xmalloc.
(build_mmap_cache): Use xcalloc, xreallocarray, and xstrdup.
(get_symbol_name): Use xreallocarray.
(stacktrace_walk, queue_put): Use xmalloc.
* util.c (printstr): Use xmalloc.
* vsprintf.c (strace_vfprintf): Likewise.
2015-05-25 20:41:02 +00:00
counts = xcalloc ( nsyscalls , sizeof ( * counts ) ) ;
2018-09-04 20:36:08 +02:00
for ( size_t i = 0 ; i < nsyscalls ; i + + )
counts [ i ] . time_min = max_ts ;
}
2018-03-16 00:55:58 +00:00
struct call_counts * cc = & counts [ tcp - > scno ] ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
2013-03-07 12:27:40 +01:00
cc - > calls + + ;
2016-12-18 22:57:57 +00:00
if ( syserror ( tcp ) )
2013-03-07 12:27:40 +01:00
cc - > errors + + ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
2018-09-02 22:07:07 +02:00
struct timespec wts ;
2018-03-16 00:55:58 +00:00
if ( count_wallclock ) {
/* wall clock time spent while in syscall */
Replace struct timeval with struct timespec in time measurements
This is required to implement more precise time measurements.
* Makefile.am (strace_LDADD): Add $(clock_LIBS).
* defs.h (struct tcb): Change the type of stime, dtime, and etime fields
from struct timeval to struct timespec, all users updated.
(syscall_exiting_decode, syscall_exiting_trace, count_syscall): Change
the type of "struct timeval *" argument to "struct timespec *", all
users updated.
(tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul): Rename to
ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul. Change
the type of all "struct timeval *" arguments to "struct timespec *",
all users updated.
* util.c (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul):
Rename to ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul.
Change the type of all "struct timeval *" arguments to "struct timespec *".
* count.c (struct call_counts): Change the type of "time" field
from struct timeval to struct timespec, all users updated.
(overhead): Change type from struct timeval to struct timespec, all
users updated.
(count_syscall): Change the type of "struct timeval *" argument to
"struct timespec *".
* strace.c (printleader): Change the type of struct timeval variables
to struct timespec, call clock_gettime instead of gettimeofday.
(next_event, trace_syscall): Change the type of struct timeval variables
to struct timespec.
* syscall.c (syscall_entering_finish, syscall_exiting_decode): Call
clock_gettime instead of gettimeofday.
2018-03-16 00:55:58 +00:00
ts_sub ( & wts , syscall_exiting_ts , & tcp - > etime ) ;
2018-03-16 00:55:58 +00:00
} else {
/* system CPU time spent while in syscall */
2018-09-03 04:57:13 +02:00
ts_sub ( & wts , & tcp - > stime , & tcp - > ltime ) ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
}
2018-09-02 22:07:07 +02:00
2018-09-03 04:57:13 +02:00
ts_sub ( & wts , & wts , & overhead ) ;
2018-09-02 22:07:07 +02:00
ts_max ( & wts , & wts , & zero_ts ) ;
2018-09-04 20:36:08 +02:00
if ( ts_cmp ( & wts , & cc - > time_min ) < 0 )
cc - > time_min = wts ;
if ( ts_cmp ( & wts , & cc - > time_max ) > 0 )
cc - > time_max = wts ;
2018-09-02 22:07:07 +02:00
ts_add ( & cc - > time , & cc - > time , & wts ) ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
}
static int
2018-09-02 23:05:27 +02:00
time_cmp ( const void * a , const void * b )
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
{
2018-09-02 23:05:27 +02:00
return - ts_cmp ( & counts [ * ( ( unsigned int * ) a ) ] . time ,
& counts [ * ( ( unsigned int * ) b ) ] . time ) ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
}
2018-09-04 20:36:08 +02:00
static int
min_time_cmp ( const void * a , const void * b )
{
return - ts_cmp ( & counts [ * ( ( unsigned int * ) a ) ] . time_min ,
& counts [ * ( ( unsigned int * ) b ) ] . time_min ) ;
}
static int
max_time_cmp ( const void * a , const void * b )
{
return - ts_cmp ( & counts [ * ( ( unsigned int * ) a ) ] . time_max ,
& counts [ * ( ( unsigned int * ) b ) ] . time_max ) ;
}
2018-09-04 19:20:36 +02:00
static int
avg_time_cmp ( const void * a , const void * b )
{
double m = counts [ * ( ( unsigned int * ) a ) ] . time_avg ;
double n = counts [ * ( ( unsigned int * ) b ) ] . time_avg ;
return ( m < n ) ? 1 : ( m > n ) ? - 1 : 0 ;
}
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
static int
2018-09-02 23:05:27 +02:00
syscall_cmp ( const void * a , const void * b )
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
{
2018-09-02 23:05:27 +02:00
const char * a_name = sysent [ * ( ( unsigned int * ) a ) ] . sys_name ;
const char * b_name = sysent [ * ( ( unsigned int * ) b ) ] . sys_name ;
2016-05-10 00:16:20 +00:00
return strcmp ( a_name ? a_name : " " , b_name ? b_name : " " ) ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
}
static int
2018-09-02 23:05:27 +02:00
count_cmp ( const void * a , const void * b )
2018-09-04 19:20:36 +02:00
{
unsigned int m = counts [ * ( ( unsigned int * ) a ) ] . calls ;
unsigned int n = counts [ * ( ( unsigned int * ) b ) ] . calls ;
return ( m < n ) ? 1 : ( m > n ) ? - 1 : 0 ;
}
static int
error_cmp ( const void * a , const void * b )
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
{
2018-09-02 23:05:27 +02:00
unsigned int m = counts [ * ( ( unsigned int * ) a ) ] . errors ;
unsigned int n = counts [ * ( ( unsigned int * ) b ) ] . errors ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
return ( m < n ) ? 1 : ( m > n ) ? - 1 : 0 ;
}
2018-09-02 23:05:27 +02:00
static int ( * sortfun ) ( const void * a , const void * b ) ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
void
2010-09-06 22:08:24 +00:00
set_sortby ( const char * sortby )
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
{
2018-09-04 13:22:11 +02:00
static const struct {
int ( * fn ) ( const void * a , const void * b ) ;
const char * name ;
} sort_fns [ ] = {
{ time_cmp , " time " } ,
{ time_cmp , " time_total " } ,
{ time_cmp , " total_time " } ,
2018-09-04 20:36:08 +02:00
{ min_time_cmp , " min_time " } ,
{ min_time_cmp , " time_min " } ,
{ max_time_cmp , " max_time " } ,
{ max_time_cmp , " time_max " } ,
2018-09-04 19:20:36 +02:00
{ avg_time_cmp , " avg_time " } ,
{ avg_time_cmp , " time_avg " } ,
2018-09-04 13:22:11 +02:00
{ count_cmp , " count " } ,
{ count_cmp , " calls " } ,
2018-09-04 19:20:36 +02:00
{ error_cmp , " errors " } ,
{ error_cmp , " error " } ,
2018-09-04 13:22:11 +02:00
{ syscall_cmp , " name " } ,
{ syscall_cmp , " syscall_name " } ,
{ syscall_cmp , " syscall " } ,
{ NULL , " nothing " } ,
{ NULL , " none " } ,
} ;
for ( size_t i = 0 ; i < ARRAY_SIZE ( sort_fns ) ; i + + ) {
if ( strcmp ( sort_fns [ i ] . name , sortby ) )
continue ;
sortfun = sort_fns [ i ] . fn ;
return ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
}
2018-09-04 13:22:11 +02:00
error_msg_and_help ( " invalid sortby: '%s' " , sortby ) ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
}
2018-09-04 19:55:40 +02:00
void
set_count_summary_columns ( const char * s )
{
static const char * cnames [ ] = {
[ CSC_TIME_100S ] = " time_percent " ,
[ CSC_TIME_TOTAL ] = " total_time " ,
2018-09-04 20:36:08 +02:00
[ CSC_TIME_MIN ] = " min_time " ,
[ CSC_TIME_MAX ] = " max_time " ,
2018-09-04 19:55:40 +02:00
[ CSC_TIME_AVG ] = " avg_time " ,
[ CSC_CALLS ] = " calls " ,
[ CSC_ERRORS ] = " errors " ,
[ CSC_SC_NAME ] = " syscall " ,
} ;
const char * pos = s ;
const char * prev = s ;
size_t cur = 0 ;
memset ( columns , 0 , sizeof ( columns ) ) ;
memset ( visible , 0 , sizeof ( visible ) ) ;
do {
bool found = false ;
pos = strchr ( prev , ' , ' ) ;
for ( size_t i = 0 ; i < ARRAY_SIZE ( cnames ) ; i + + ) {
if ( ! cnames [ i ] | | ( pos
? ( ( size_t ) ( pos - prev ) ! = strlen ( cnames [ i ] ) )
| | strncmp ( prev , cnames [ i ] , pos - prev )
: strcmp ( prev , cnames [ i ] ) ) ) {
continue ;
}
if ( visible [ i ] )
error_msg_and_help ( " call summary column "
" has been provided more "
" than once: '%s' (-U option "
" residual: '%s') " ,
cnames [ i ] , prev ) ;
columns [ cur + + ] = i ;
visible [ i ] = 1 ;
found = true ;
break ;
}
if ( ! found )
error_msg_and_help ( " unknown column name: '%.*s' " ,
( int ) ( pos ? pos - prev : INT_MAX ) ,
prev ) ;
prev = pos + 1 ;
} while ( pos ) ;
}
2018-09-02 21:56:47 +02:00
void
set_overhead ( const char * str )
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
{
2018-09-02 21:56:47 +02:00
if ( parse_ts ( str , & overhead ) < 0 )
error_msg_and_help ( " invalid -O argument: '%s' " , str ) ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
}
2018-09-04 19:15:08 +02:00
static size_t ATTRIBUTE_FORMAT ( ( printf , 1 , 2 ) )
num_chars ( const char * fmt , . . . )
{
va_list ap ;
va_start ( ap , fmt ) ;
int ret = vsnprintf ( NULL , 0 , fmt , ap ) ;
va_end ( ap ) ;
return ( unsigned int ) MAX ( ret , 0 ) ;
}
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
static void
call_summary_pers ( FILE * outf )
{
2018-09-04 19:15:08 +02:00
enum column_flags {
CF_L = 1 < < 0 , /* Left-aligned column */
} ;
static const struct {
const char * s ;
size_t sz ;
const char * fmt ;
uint32_t flags ;
} cdesc [ ] = {
[ CSC_TIME_100S ] = { ARRSZ_PAIR ( " % time " ) , " %*.2f " } ,
[ CSC_TIME_TOTAL ] = { ARRSZ_PAIR ( " seconds " ) , " %*.6f " } ,
2018-09-04 20:36:08 +02:00
[ CSC_TIME_MIN ] = { ARRSZ_PAIR ( " shortest " ) , " %*.6f " } ,
[ CSC_TIME_MAX ] = { ARRSZ_PAIR ( " longest " ) , " %*.6f " } ,
2018-09-04 19:15:08 +02:00
[ CSC_TIME_AVG ] = { ARRSZ_PAIR ( " usecs/call " ) , " %*lu " } ,
[ CSC_CALLS ] = { ARRSZ_PAIR ( " calls " ) , " %* " PRIu64 } ,
[ CSC_ERRORS ] = { ARRSZ_PAIR ( " errors " ) , " %* " PRIu64 } ,
[ CSC_SC_NAME ] = { ARRSZ_PAIR ( " syscall " ) , " %-*s " , CF_L } ,
} ;
unsigned int * indices ;
struct timespec tv_cum = zero_ts ;
2018-09-04 20:36:08 +02:00
struct timespec tv_min = max_ts ;
struct timespec tv_max = zero_ts ;
2018-09-04 19:15:08 +02:00
uint64_t call_cum = 0 ;
uint64_t error_cum = 0 ;
double float_tv_cum ;
double percent ;
double ts_avg_max = 0 ;
size_t sc_name_max = 0 ;
/* sort, calculate statistics */
indices = xcalloc ( sizeof ( indices [ 0 ] ) , nsyscalls ) ;
for ( size_t i = 0 ; i < nsyscalls ; i + + ) {
struct timespec dtv ;
indices [ i ] = i ;
if ( counts [ i ] . calls = = 0 )
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
continue ;
2018-09-04 19:15:08 +02:00
ts_add ( & tv_cum , & tv_cum , & counts [ i ] . time ) ;
2018-09-04 20:36:08 +02:00
ts_min ( & tv_min , & tv_min , & counts [ i ] . time_min ) ;
ts_max ( & tv_max , & tv_max , & counts [ i ] . time_max ) ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
call_cum + = counts [ i ] . calls ;
error_cum + = counts [ i ] . errors ;
2018-09-04 19:15:08 +02:00
ts_div ( & dtv , & counts [ i ] . time , counts [ i ] . calls ) ;
counts [ i ] . time_avg = ts_float ( & dtv ) ;
ts_avg_max = MAX ( ts_avg_max , counts [ i ] . time_avg ) ;
sc_name_max = MAX ( sc_name_max , strlen ( sysent [ i ] . sys_name ) ) ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
}
Replace struct timeval with struct timespec in time measurements
This is required to implement more precise time measurements.
* Makefile.am (strace_LDADD): Add $(clock_LIBS).
* defs.h (struct tcb): Change the type of stime, dtime, and etime fields
from struct timeval to struct timespec, all users updated.
(syscall_exiting_decode, syscall_exiting_trace, count_syscall): Change
the type of "struct timeval *" argument to "struct timespec *", all
users updated.
(tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul): Rename to
ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul. Change
the type of all "struct timeval *" arguments to "struct timespec *",
all users updated.
* util.c (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul):
Rename to ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul.
Change the type of all "struct timeval *" arguments to "struct timespec *".
* count.c (struct call_counts): Change the type of "time" field
from struct timeval to struct timespec, all users updated.
(overhead): Change type from struct timeval to struct timespec, all
users updated.
(count_syscall): Change the type of "struct timeval *" argument to
"struct timespec *".
* strace.c (printleader): Change the type of struct timeval variables
to struct timespec, call clock_gettime instead of gettimeofday.
(next_event, trace_syscall): Change the type of struct timeval variables
to struct timespec.
* syscall.c (syscall_entering_finish, syscall_exiting_decode): Call
clock_gettime instead of gettimeofday.
2018-03-16 00:55:58 +00:00
float_tv_cum = ts_float ( & tv_cum ) ;
2018-09-04 19:15:08 +02:00
if ( sortfun )
qsort ( ( void * ) indices , nsyscalls , sizeof ( indices [ 0 ] ) , sortfun ) ;
/* calculate column widths */
# define W_(c_, v_) [c_] = MAX((cdesc[c_].sz - 1), (v_))
unsigned int cwidths [ CSC_MAX ] = {
W_ ( CSC_TIME_100S , sizeof ( " 100.00 " ) - 1 ) ,
W_ ( CSC_TIME_TOTAL , num_chars ( " %.6f " , float_tv_cum ) ) ,
2018-09-04 20:36:08 +02:00
W_ ( CSC_TIME_MIN , num_chars ( " %ld.000000 " , tv_min . tv_sec ) ) ,
W_ ( CSC_TIME_MAX , num_chars ( " %ld.000000 " , tv_max . tv_sec ) ) ,
2018-09-04 19:15:08 +02:00
W_ ( CSC_TIME_AVG , num_chars ( " %lu " , ( unsigned long )
( ts_avg_max * 1e6 ) ) ) ,
W_ ( CSC_CALLS , num_chars ( " % " PRIu64 , call_cum ) ) ,
W_ ( CSC_ERRORS , num_chars ( " % " PRIu64 , error_cum ) ) ,
W_ ( CSC_SC_NAME , sc_name_max + 1 ) ,
} ;
# undef W_
/* header */
for ( size_t i = 0 ; columns [ i ] & & i < ARRAY_SIZE ( columns ) ; i + + ) {
const char * fmt = cdesc [ columns [ i ] ] . flags & CF_L
? " %s%-*s " : " %s%*s " ;
fprintf ( outf , fmt , i ? " " : " " , cwidths [ columns [ i ] ] ,
cdesc [ columns [ i ] ] . s ) ;
}
fputc ( ' \n ' , outf ) ;
for ( size_t i = 0 ; columns [ i ] & & i < ARRAY_SIZE ( columns ) ; i + + ) {
if ( i )
fputc ( ' ' , outf ) ;
for ( size_t j = 0 ; j < cwidths [ columns [ i ] ] ; j + + )
fputc ( ' - ' , outf ) ;
}
fputc ( ' \n ' , outf ) ;
/* data output */
for ( size_t i = 0 ; i < nsyscalls ; i + + ) {
unsigned int idx = indices [ i ] ;
struct call_counts * cc = & counts [ idx ] ;
double float_syscall_time ;
if ( cc - > calls = = 0 )
continue ;
float_syscall_time = ts_float ( & cc - > time ) ;
percent = ( 100.0 * float_syscall_time ) ;
/* else: float_tv_cum can be 0.0 too and we get 0/0 = NAN */
if ( percent ! = 0.0 )
percent / = float_tv_cum ;
for ( size_t i = 0 ; columns [ i ] & & i < ARRAY_SIZE ( columns ) ; i + + ) {
const size_t c = columns [ i ] ;
if ( i )
fputc ( ' ' , outf ) ;
# define PC_(c_, val_) \
case ( c_ ) : fprintf ( outf , cdesc [ c ] . fmt , cwidths [ c ] , ( val_ ) ) ; break ;
switch ( c ) {
PC_ ( CSC_TIME_100S , percent )
PC_ ( CSC_TIME_TOTAL , float_syscall_time )
2018-09-04 20:36:08 +02:00
PC_ ( CSC_TIME_MIN , ts_float ( & cc - > time_min ) )
PC_ ( CSC_TIME_MAX , ts_float ( & cc - > time_max ) )
2018-09-04 19:15:08 +02:00
PC_ ( CSC_TIME_AVG , ( long ) ( cc - > time_avg * 1e6 ) )
PC_ ( CSC_CALLS , cc - > calls )
case CSC_ERRORS :
if ( cc - > errors )
fprintf ( outf , cdesc [ c ] . fmt ,
cwidths [ c ] , cc - > errors ) ;
else
fprintf ( outf , " %*s " , cwidths [ c ] , " " ) ;
break ;
PC_ ( CSC_SC_NAME , sysent [ idx ] . sys_name )
}
}
fputc ( ' \n ' , outf ) ;
}
free ( indices ) ;
/* footer */
for ( size_t i = 0 ; columns [ i ] & & i < ARRAY_SIZE ( columns ) ; i + + ) {
if ( i )
fputc ( ' ' , outf ) ;
for ( size_t j = 0 ; j < cwidths [ columns [ i ] ] ; j + + )
fputc ( ' - ' , outf ) ;
}
fputc ( ' \n ' , outf ) ;
/* totals */
for ( size_t i = 0 ; columns [ i ] & & i < ARRAY_SIZE ( columns ) ; i + + ) {
const size_t c = columns [ i ] ;
if ( i )
fputc ( ' ' , outf ) ;
switch ( c ) {
PC_ ( CSC_TIME_100S , 100.0 )
PC_ ( CSC_TIME_TOTAL , float_tv_cum )
2018-09-04 20:36:08 +02:00
PC_ ( CSC_TIME_MIN , ts_float ( & tv_min ) )
PC_ ( CSC_TIME_MAX , ts_float ( & tv_max ) )
2018-09-04 19:15:08 +02:00
PC_ ( CSC_TIME_AVG ,
( unsigned long ) ( float_tv_cum / call_cum * 1e6 ) )
PC_ ( CSC_CALLS , call_cum )
PC_ ( CSC_ERRORS , error_cum )
PC_ ( CSC_SC_NAME , " total " )
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
}
}
2018-09-04 19:15:08 +02:00
fputc ( ' \n ' , outf ) ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
2018-09-04 19:15:08 +02:00
# undef PC_
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
}
void
call_summary ( FILE * outf )
{
2014-09-10 13:46:04 +00:00
unsigned int i , old_pers = current_personality ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
2011-06-22 14:32:43 +02:00
for ( i = 0 ; i < SUPPORTED_PERSONALITIES ; + + i ) {
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
if ( ! countv [ i ] )
continue ;
if ( current_personality ! = i )
set_personality ( i ) ;
if ( i )
fprintf ( outf ,
2018-01-05 03:00:45 +01:00
" System call usage summary for %s mode: \n " ,
personality_names [ i ] ) ;
2006-12-21 Dmitry V. Levin <ldv@altlinux.org>
Move counts code to separate file.
* count.c: New file.
* Makefile.am (strace_SOURCES): Add count.c.
* syscall.c (call_counts, countv, counts, shortest, time_cmp,
syscall_cmp, count_cmp, sortfun, overhead, set_sortby,
set_overhead, call_summary_pers, call_summary): Move to count.c
* count.c (count_syscall): New function.
* defs.h (count_syscall): Declare it.
* syscall.c (trace_syscall): Use it.
2006-12-21 21:15:04 +00:00
call_summary_pers ( outf ) ;
}
if ( old_pers ! = current_personality )
set_personality ( old_pers ) ;
}