support zsh profiling via $ZSH_PROFILE_RC and profile()
authorMichael Prokop <mika@grml.org>
Fri, 5 Jan 2007 18:36:19 +0000 (19:36 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 5 Jan 2007 18:36:19 +0000 (19:36 +0100)
debian/changelog
etc/zsh/zshrc

index cb3ea12..e98402f 100644 (file)
@@ -7,6 +7,7 @@ grml-etc-core (0.2.15) unstable; urgency=low
     - improved host completion (thanks for some code, Kai Wilke!)
     - added apache2-ssl-certificate() as Debian does not ship
       the script anymore *grml*
+    - support zsh profiling via $ZSH_PROFILE_RC and profile()
     - added alias 0 which does nothing else than 'return 0' (I like
       a clean prompt without error return codes inside but don't
       want to miss the feature itself, so just press 0<cr> and that's
index 116d35a..aa1fddf 100644 (file)
@@ -3,7 +3,7 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Fre Jän 05 00:00:23 CET 2007 [mika]
+# Latest change: Fre Jän 05 19:35:27 CET 2007 [mika]
 ################################################################################
 # This file is sourced only for interactive shells. It
 # should contain commands to set up aliases, functions,
 # Global Order: zshenv, zprofile, zshrc, zlogin
 ################################################################################
 
+# zsh profiling {{{
+# just execute 'ZSH_PROFILE_RC=1 zsh' and run 'zprof' to get the details
+  if [[ -n $ZSH_PROFILE_RC ]] ; then
+     zmodload zsh/zprof
+  fi
+# }}}
+
 # {{{ check for version/system
 # check for versions (compatibility reasons)
   if autoload is-at-least && is-at-least 2>/dev/null ; then
@@ -256,7 +263,7 @@ fi
 # autoload zsh modules when they are referenced
   is4 && for opt mod in a  stat    \
                         a  zpty    \
-                        a  zprof   \
+                        ap zprof   \
                         ap mapfile ; do
              zmodload -${opt} zsh/${mod} ${mod}
          done ; unset opt mod
@@ -947,6 +954,11 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"."
   _uchange() { _files -W /usr/share/doc -/ }
   compdef _uchange uchange
 
+# zsh profiling
+  profile () {
+      ZSH_PROFILE_RC=1 $SHELL "$@"
+  }
+
 # edit alias via zle:
   edalias() {
     [ -z "$1" ] && { echo "Usage: edalias <alias_to_edit>" ; return 1 } || vared aliases'[$1]' ;