Summary: | [patch] shells/zsh: correct memory report for time builtin | ||||||
---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | swell.k <swell.k> | ||||
Component: | Individual Port(s) | Assignee: | Baptiste Daroussin <bapt> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Only Me | ||||||
Priority: | Normal | ||||||
Version: | Latest | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
Description
swell.k
2010-12-04 03:50:10 UTC
Responsible Changed From-To: freebsd-ports-bugs->des Over to maintainer (via the GNATS Auto Assign Tool) State Changed From-To: open->feedback Patch submitted upstream Responsible Changed From-To: des->bapt I'll take it. This should also work when _SC_CLK_TCK is not defined. http://www.zsh.org/mla/users/2010/msg00906.html And for a value calculated using stathz see bin/78787. --- a.diff begins here --- Index: shells/zsh/files/patch-Src-jobs.c =================================================================== RCS file: shells/zsh/files/patch-Src-jobs.c diff -N shells/zsh/files/patch-Src-jobs.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ shells/zsh/files/patch-Src-jobs.c 19 Jun 2011 17:37:08 -0000 @@ -0,0 +1,47 @@ +diff --git a/Src/jobs.c b/Src/jobs.c +index 9c9b12f..2da1d66 100644 +--- Src/jobs.c~ ++++ Src/jobs.c +@@ -586,7 +586,6 @@ setprevjob(void) + } + + /**/ +-#ifndef HAVE_GETRUSAGE + static long clktck = 0; + + /**/ +@@ -616,7 +615,6 @@ set_clktck(void) + #endif + } + /**/ +-#endif + + /**/ + static void +@@ -659,14 +657,14 @@ printtime(struct timeval *real, child_times_t *ti, char *desc) + /* go ahead and compute these, since almost every TIMEFMT will have them */ + elapsed_time = real->tv_sec + real->tv_usec / 1000000.0; + ++ set_clktck(); + #ifdef HAVE_GETRUSAGE + user_time = ti->ru_utime.tv_sec + ti->ru_utime.tv_usec / 1000000.0; + system_time = ti->ru_stime.tv_sec + ti->ru_stime.tv_usec / 1000000.0; + total_time = user_time + system_time; +- percent = 100.0 * total_time +- / (real->tv_sec + real->tv_usec / 1000000.0); ++ percent = 100.0 * total_time / elapsed_time; ++ total_time *= (double) clktck; + #else +- set_clktck(); + user_time = ti->ut / (double) clktck; + system_time = ti->st / (double) clktck; + percent = 100.0 * (ti->ut + ti->st) +@@ -752,7 +750,7 @@ printtime(struct timeval *real, child_times_t *ti, char *desc) + #endif + #ifdef HAVE_STRUCT_RUSAGE_RU_MAXRSS + case 'M': +- fprintf(stderr, "%ld", ti->ru_maxrss / 1024); ++ fprintf(stderr, "%ld", ti->ru_maxrss); + break; + #endif + #ifdef HAVE_STRUCT_RUSAGE_RU_MAJFLT --- a.diff ends here --- bapt 2011-11-06 18:35:06 UTC FreeBSD ports repository Modified files: shells/zsh Makefile Log: - split the zsh_mem option into zsh_mem and zsh_secure_free activate secure_free my default disable mem by default[1] - correct memory report for time builtin [2] - bump portrevision PR: ports/143981 [1], ports/152820 [2] Submitted by: Richard Kolkovich <sarumont@sigil.org> [1], Anonymous <swell.k@gmail.com> and Tsu <inyaoo@gmail.com> [2] Hurried by: miwi :) Revision Changes Path 1.129 +19 -8 ports/shells/zsh/Makefile _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org" State Changed From-To: feedback->closed Committed. Thanks! |