zsh-users
 help / color / mirror / code / Atom feed
* zsh debug tracing with timestamp
@ 2001-04-15  6:47 Paul Lew
  2001-04-15 19:49 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Lew @ 2001-04-15  6:47 UTC (permalink / raw)
  To: zsh-users

Any method to insert timestamp in front of the trace command turned on
by set -x?  We try to troubleshoot zsh startup time problem when
people sharing the common zsh startup across US and in India.
Timestamp will give us a clue which part take the longest and we
can then make proper adjustment.

Any help will be appreciated.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: zsh debug tracing with timestamp
  2001-04-15  6:47 zsh debug tracing with timestamp Paul Lew
@ 2001-04-15 19:49 ` Bart Schaefer
  2001-04-15 20:22   ` Dan Nelson
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2001-04-15 19:49 UTC (permalink / raw)
  To: Paul Lew, zsh-users

On Apr 14, 11:47pm, Paul Lew wrote:
} Subject: zsh debug tracing with timestamp
}
} Any method to insert timestamp in front of the trace command turned on
} by set -x?

Yes, if you're using 3.1.6 or later.  Just set PS4 using any of the usual
prompt expansion escapes, e.g.:

% PS4=': %D %T ; '
% set -x
% sleep 5; echo hello
: 01-04-15 12:43 ; sleep 5
: 01-04-15 12:43 ; echo hello
hello

If you need finer granularity, setopt promptsubst and use $SECONDS:

% setopt promptsubst
: 01-04-15 12:44 ; setopt promptsubst
% PS4=': %D %T {$SECONDS}; '
: 01-04-15 12:44 ; PS4=: %D %T {$SECONDS};  
% sleep 5; echo hello
: 01-04-15 12:45 {261}; sleep 5
: 01-04-15 12:45 {266}; echo hello
hello

One-second granularity is the smallest you can get.

I chose the :...; format so that you can cut-and-paste the trace output
into another shell and the leading timestamps will be ignored.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: zsh debug tracing with timestamp
  2001-04-15 19:49 ` Bart Schaefer
@ 2001-04-15 20:22   ` Dan Nelson
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Nelson @ 2001-04-15 20:22 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Paul Lew, zsh-users

In the last episode (Apr 15), Bart Schaefer said:
> On Apr 14, 11:47pm, Paul Lew wrote:
> } Subject: zsh debug tracing with timestamp
> }
> } Any method to insert timestamp in front of the trace command turned on
> } by set -x?
> 
> Yes, if you're using 3.1.6 or later.  Just set PS4 using any of the usual
> prompt expansion escapes, e.g.:
> 
> % PS4=': %D %T ; '
> % set -x
> % sleep 5; echo hello
> : 01-04-15 12:43 ; sleep 5
> : 01-04-15 12:43 ; echo hello
> hello
> 
> If you need finer granularity, setopt promptsubst and use $SECONDS:

not needed; just use %D{%Y-%m-%d %H:%M:%S}, which will give you
seconds.

-- 
	Dan Nelson
	dnelson@emsphone.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-04-15 20:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-15  6:47 zsh debug tracing with timestamp Paul Lew
2001-04-15 19:49 ` Bart Schaefer
2001-04-15 20:22   ` Dan Nelson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).