From 11aa496ee8f9c29f90b108bb8f7136e3791f1c18 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 25 May 2000 23:22:02 +0200 Subject: [PATCH] patch::: 1.3.54.jcn1 1.3.54.jcn1 =========== * Fixed compile bug. * Added scripts/linux-time.py: simple utility to monitor memory (and later maybe other) resource usage from Linux's proc fs. --- Generated by janneke@gnu.org, From = lilypond-1.3.54, To = lilypond-1.3.54.jcn1 usage cd lilypond-source-dir; patch -E -p1 < lilypond-1.3.54.jcn1.diff Patches do not contain automatically generated files or (urg) empty directories, i.e., you should rerun autoconf, configure --- CHANGES | 15 +++- VERSION | 2 +- buildscripts/set-lily.sh | 1 + lily/staff-symbol-referencer.cc | 3 +- scripts/linux-time.py | 151 ++++++++++++++++++++++++++++++++ 5 files changed, 169 insertions(+), 3 deletions(-) create mode 100644 scripts/linux-time.py diff --git a/CHANGES b/CHANGES index 1e07902ff9..4f557042f3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,17 @@ -1.3.1.3.54.hwn1 +--- ../lilypond-1.3.54/CHANGES Thu May 25 00:20:46 2000 +++ b/CHANGES Thu May 25 23:22:02 2000 +@@ -1,3 +1,11 @@ +1.3.54.jcn1 +=========== + +* Fixed compile bug. + +* Added scripts/linux-time.py: simple utility to monitor memory (and later + maybe other) resource usage from Linux's proc fs. + + 1.3.53.uu1 + ========== + 1.3.1.3.54.hwn1 =========== * Massive search replace patch: store pointers and properties diff --git a/VERSION b/VERSION index 12c3a81827..4e3376e8bb 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=54 -MY_PATCH_LEVEL=hwn1 +MY_PATCH_LEVEL=jcn1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/buildscripts/set-lily.sh b/buildscripts/set-lily.sh index df01378c45..383a116988 100755 --- a/buildscripts/set-lily.sh +++ b/buildscripts/set-lily.sh @@ -57,6 +57,7 @@ showln -sf $LILYPOND_SOURCEDIR/midi2ly/out/midi2ly $prefix/bin/midi2ly showln -sf $LILYPOND_SOURCEDIR/scripts/out/ly2dvi $prefix/bin/ly2dvi showln -sf $LILYPOND_SOURCEDIR/scripts/out/mudela-book $prefix/bin/mudela-book showln -sf $LILYPOND_SOURCEDIR/buildscripts/out/genheader $prefix/bin/genheader +showln -sf $LILYPOND_SOURCEDIR/scripts/out/linux-time $prefix/bin/linux-time showln -sf $LILYPOND_SOURCEDIR/scripts/out/as2text $prefix/bin/as2text diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index 328957da32..0540f9f0ae 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -98,7 +98,8 @@ Staff_symbol_referencer_interface::callback (Score_element const* sc,Axis ) Real space = staff_symbol_referencer (sc).staff_space (); off = gh_scm2double (pos) * space/2.0; } - sc->set_elt_property ("staff-position", gh_double2scm (0.0)); + Score_element* urg = (Score_element*)sc; + urg->set_elt_property ("staff-position", gh_double2scm (0.0)); return off; } diff --git a/scripts/linux-time.py b/scripts/linux-time.py new file mode 100644 index 0000000000..b41abc4355 --- /dev/null +++ b/scripts/linux-time.py @@ -0,0 +1,151 @@ +#!@PYTHON@ +# linux-time.py -- Print resourse usage of a command executing on GNU/Linux +# +# awaiting PC's linux-mm patch for getrusage +# +# source file of the GNU LilyPond music typesetter +# +# (c) 2000 Jan Nieuwenhuizen +# + +name = 'linux-time' +version = '@TOPLEVEL_VERSION@' +if version == '@' + 'TOPLEVEL_VERSION' + '@': + version = '(unknown version)' # uGUHGUHGHGUGH + +import string +import getopt +import sys +import os +import time +import posix +import signal + +def identify(): + sys.stderr.write ("%s from LilyPond %s\n" % (name, version)) + +def help (): + print (r""" +Usage: %s [OPTION]... COMMAND + +Print resourse usage of a command executing on GNU/Linux. + +Options: + -h, --help this help + -v, --version version information +""" % name) + +def print_version (): + print (r"""%s (GNU LilyPond) %s""" % (name, version)) + +(options, files) = getopt.getopt (sys.argv[1:], 'vh', ['help','version']) + +for opt in options: + o = opt[0] + a = opt[1] + if o== '--help' or o == '-h': + help () + sys.exit (0) + if o == '--version' or o == '-v': + print_version () + sys.exit (0) + else: + print o + raise getopt.error + +# identify () + +if len (files) < 1: + help () + sys.exit (2) + +#command = files[0] +#sys.system ("/usr/bin/time %s" % command) +pid = 0 +status = 0 +t = 0 +avg_size = 0 +max_size = 0 +avg_rss = 0 +max_rss = 0 +INTERVAL = 0.1 + +# why doesn't it work when put in a function? +#def time (): +# global status, t; +# #child_pid = os.fork () +# child_pid = forkit () +# if child_pid: +# #Parent +# while 1: +# try: +# # AARg, wait takes only 1 argument, +# # but this still compiled +# #(pid, status) = os.wait (child_pid, os.WNOHANG) +# (pid, status) = os.waitpid (child_pid, os.WNOHANG) +# if not pid: +# time.sleep (INTERVAL) +# t = t + 1 +# print ("s: %d" % t) +# except: +# break +# else: +# # Child +# status = os.system ("/usr/bin/time %s" % string.join (files, " ")) +# sys.exit (status) + + +if 0: + # cute, but this doesn't work: we get resources of /usr/bin/time + command = "/usr/bin/time" + args = files +else: + # we should do 'time' ourselves: + # man 5 proc + command = files[0] + args = files[1:] + + +child_pid = os.fork () +if child_pid: + #Parent + statm = "/proc/%d/statm" % child_pid + while 1: + try: + # AARg, wait takes only 1 argument, + # but this still compiled + #(pid, status) = os.wait (child_pid, os.WNOHANG) + (pid, status) = os.waitpid (child_pid, os.WNOHANG) + except: + break + if pid: + break + + time.sleep (INTERVAL) + f = open (statm, "r") + stats = f.readline () + f.close () + (size, rss, drie, vier, vijf, zes, zeven) = string.split (stats, " ") + t = t + 1 + size = string.atoi (size) + max_size = max (size, max_size) + avg_size = avg_size + size + rss = string.atoi (rss) + max_rss = max (rss, max_rss) + avg_rss = avg_rss + rss +else: + # Child + #status = os.system ("/usr/bin/time %s" % string.join (files, " ")) + #sys.exit (status) + os.execvp (command, (command,) + tuple (args)) + + +ms = max_size * 4.0/1024 +mr = max_size * 4.0/1024 +avg_size = avg_size / t +avg_rss = avg_rss / t +as = avg_size * 4.0/1024 +ar = avg_rss * 4.0/1024 +print ("MAXSIZE: %6.3fM(%d), MAXRSS: %6.3fM(%d)" % (ms, max_size, mr, max_rss)) +print ("AVGSIZE: %6.3fM(%d), AVGRSS: %6.3fM(%d)" % (as, avg_size, ar, avg_rss)) +sys.exit (status) -- 2.39.5