From: Apple Date: Wed, 6 Aug 2008 23:56:19 +0000 (+0000) Subject: system_cmds-433.4.tar.gz X-Git-Tag: mac-os-x-1056^0 X-Git-Url: https://git.saurik.com/apple/system_cmds.git/commitdiff_plain/c03df0e9b5e00ac087fc7c53f812f6d1dd92f2a8?ds=sidebyside system_cmds-433.4.tar.gz --- diff --git a/latency.tproj/latency.1 b/latency.tproj/latency.1 index 8978522..debed8b 100644 --- a/latency.tproj/latency.1 +++ b/latency.tproj/latency.1 @@ -9,6 +9,7 @@ .Sh SYNOPSIS .Nm latency .Op Fl rt +.Op Fl h .Op Fl c Ar code_file .Op Fl l Ar log_file .Op Fl st Ar threshold @@ -59,6 +60,9 @@ This option allows you to specify an alternate booted kernel. Sets the real-time scheduling policy. Default policy is timeshare. .\" ========== +.It Fl h +Display high resolution interrupt latencies and write them to latencies.csv (truncate existing file) upon exit. +.\" ========== .It Fl s Ar sleep_in_usecs Sets the timer, taking an argument expressed in microseconds. The default timer is set to 1000 microseconds. diff --git a/latency.tproj/latency.c b/latency.tproj/latency.c index d24fb57..992401e 100644 --- a/latency.tproj/latency.c +++ b/latency.tproj/latency.c @@ -106,6 +106,11 @@ int my_policy; int my_pri = -1; int num_of_usecs_to_sleep = 1000; +#define N_HIGH_RES_BINS 500 +int use_high_res_bins = false; +int i_high_res_bins[N_HIGH_RES_BINS]; +int i_highest_latency = 0; + char *kernelpath = (char *)0; char *code_file = (char *)0; @@ -425,6 +430,21 @@ set_init_logging() quit("trace facility failure, KERN_KDSETUP\n"); } +void +write_high_res_latencies() +{ + int i; + FILE *f; + if(use_high_res_bins) + { + f = fopen("latencies.csv","w"); + for(i=0;i i_highest_latency) + i_highest_latency = elapsed_usecs; + i_high_res_bins[elapsed_usecs]++; + } + if (i_thresh_hold && elapsed_usecs > i_thresh_hold) i_exceeded_threshold++; if (elapsed_usecs > i_max_latency) @@ -2064,7 +2131,7 @@ double handle_decrementer(kd_buf *kd) void init_code_file() { FILE *fp; - int i, n, cnt, code; + int i, n, code; char name[128]; if ((fp = fopen(code_file, "r")) == (FILE *)0) { @@ -2072,16 +2139,15 @@ void init_code_file() fprintf(log_fp, "open of %s failed\n", code_file); return; } - n = fscanf(fp, "%d\n", &cnt); - - if (n != 1) { - if (log_fp) - fprintf(log_fp, "bad format found in %s\n", code_file); - return; - } for (i = 0; i < MAX_ENTRIES; i++) { n = fscanf(fp, "%x%127s\n", &code, name); + if (n == 1 && i == 0) { + /* + * old code file format, just skip + */ + continue; + } if (n != 2) break; diff --git a/zic.tproj/Makefile b/zic.tproj/Makefile index d99b266..f2d77db 100644 --- a/zic.tproj/Makefile +++ b/zic.tproj/Makefile @@ -28,7 +28,7 @@ ZONEINFO = $(DSTROOT)/usr/share/zoneinfo # the tzdata*.tar.gz file is automatically unpacked and a version file created # /usr/local/share/tz/tzdata*.tar.gz is installed by the TimeZoneData project DATFILES = $(OBJROOT)/datfiles -TARBALL = $(shell echo /usr/local/share/tz/tzdata*) +TARBALL = $(shell ls $(SDKROOT)/usr/local/share/tz/tzdata* | sort | tail -n 1) DATVERS = $(shell basename $(TARBALL) | sed -e 's,\..*,,' -e 's/^tzdata//') VERSIONFILE = $(ZONEINFO)/+VERSION