X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Flily.scm;h=9d3af0c50d5151085e73b5be985a92a7da077a29;hb=2f8ee26611b5b7e52528d8f5a3324b64270119f1;hp=78430f882e0cf4e4d02e9598086f943d93cd5f3d;hpb=d53a0536f899eae5f2e9c50e7b2e2b5636f5b026;p=lilypond.git diff --git a/scm/lily.scm b/scm/lily.scm index 78430f882e..9d3af0c50d 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -5,6 +5,14 @@ ;;;; (c) 1998--2006 Jan Nieuwenhuizen ;;;; Han-Wen Nienhuys +;; Internationalisation: (_i "to be translated") gets an entry in the +;; POT file (gettext ) must be invoked explicitely to do the actual +;; "translation". +;;(define-macro (_i x) x) +;;(define-macro-public _i (x) x) +;;(define-public-macro _i (x) x) +;; Abbrv-PWR! +(defmacro-public _i (x) x) (define (define-scheme-options) (for-each (lambda (x) @@ -21,26 +29,28 @@ (check-internal-types #f "check every property assignment for types") (clip-systems #f "Generate cut-out snippets of a score") (debug-gc #f "dump memory debugging statistics") - (debug-gc-assert-parsed-dead - #f "for memory debugging: ensure that all refs to parsed objects are dead.") + (debug-gc-assert-parsed-dead #f "for memory debugging: +ensure that all refs to parsed objects are dead. This is an internal option, and is switched on automatically for -ddebug-gc.") (debug-lexer #f "debug the flex lexer") (debug-midi #f "generate human readable MIDI") (debug-parser #f "debug the bison parser") (debug-skylines #f "debug skylines") (delete-intermediate-files #f "delete unusable PostScript files") - (dump-signatures #f "dump output signatures of each system") + (dump-profile #f "dump timing information for each file") (dump-tweaks #f "dump page layout and tweaks for each score having the tweak-key layout property set.") + (dump-signatures #f "dump output signatures of each system. Used for regression testing.") + + (eps-box-padding #f "Pad EPS bounding box left edge. Guarantee alignment between systems in LaTeX.") (gs-load-fonts #f "load fonts via Ghostscript.") + (gui #f "running from gui; redirect stderr to log file") + (include-book-title-preview #t "include book-titles in preview images.") (include-eps-fonts #t "Include fonts in separate-system EPS files.") (job-count #f "Process in parallel") - - (eps-box-padding #f "Pad EPS bounding box left edge by this much to guarantee alignment between systems") - - (gui #f "running from gui; redirect stderr to log file") (log-file #f "redirect output to log FILE.log") + (old-relative #f "relative for simultaneous music works similar to chord syntax") @@ -58,14 +68,12 @@ on errors, and print a stack trace.") (read-file-list #f "Read files to be processed from command line arguments") (safe #f "Run safely") - (strict-infinity-checking #f "If yes, crash on encountering Inf/NaN") - + (strict-infinity-checking #f "If yes, crash on encountering Inf/NaN.") + (separate-log-files #f "Output to FILE.log per file.") (ttf-verbosity 0 "how much verbosity for TTF font embedding?") - (show-available-fonts #f - "List font names available.") - + "List font names available.") (verbose ,(ly:command-line-verbose?) "value for the --verbose flag") ))) @@ -90,12 +98,11 @@ on errors, and print a stack trace.") (srfi srfi-13) (srfi srfi-14) (scm clip-region) - ) - ;; my display -(define-public (myd k v) (display k) (display ": ") (display v) (display ", ")) +(define-public (myd k v) (display k) (display ": ") (display v) (display ", ") + v) (define-public (print . args) (apply format (cons (current-output-port) args))) @@ -141,7 +148,7 @@ on errors, and print a stack trace.") (if (ly:get-option 'verbose) (ly:progress "[~A" file-name)) (if (not file-name) - (ly:error (_ "Can't find ~A") x)) + (ly:error (_ "cannot find: ~A") x)) (primitive-load file-name) (if (ly:get-option 'verbose) (ly:progress "]")))) @@ -348,6 +355,33 @@ The syntax is the same as `define*-public'." (,symbol? . "symbol") (,vector? . "vector"))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; timing + +(define (profile-measurements) + (let* ((t (times)) + (stats (gc-stats))) + + (list + (- (+ (tms:cutime t) + (tms:utime t)) + (ly:assoc-get 'gc-time-taken stats)) + + (ly:assoc-get 'total-cells-allocated stats 0) + ))) + +(define (dump-profile base last this) + (let* + ((outname (format "~a.profile" (basename base ".ly"))) + (diff (map (lambda (y) (apply - y)) (zip this last)))) + + (ly:progress "\nWriting timing to ~a..." outname) + (format (open-file outname "w") + "time: ~a\ncells: ~a\n" + (car diff) + (cadr diff) + ))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; debug mem leaks @@ -395,6 +429,7 @@ The syntax is the same as `define*-public'." (ly:reset-all-fonts) (gc) (gc) + (display "Asserting dead objects\n") (ly:set-option 'debug-gc-assert-parsed-dead #t) (gc) (ly:set-option 'debug-gc-assert-parsed-dead #f) @@ -471,7 +506,7 @@ The syntax is the same as `define*-public'." )) (if (and (number? (ly:get-option 'job-count)) - (> (length files) (ly:get-option 'job-count))) + (>= (length files) (ly:get-option 'job-count))) (let* ((count (ly:get-option 'job-count)) @@ -513,6 +548,10 @@ The syntax is the same as `define*-public'." (if (pair? errors) (ly:error "Children ~a exited with errors." errors)) + ;; must overwrite individual entries + (if (ly:get-option 'dump-profile) + (dump-profile "lily-run-total" '(0 0) (profile-measurements))) + (exit (if (null? errors) 0 1)))))) @@ -539,26 +578,57 @@ The syntax is the same as `define*-public'." )) (let* ((failed '()) - (first #t) + (separate-logs (ly:get-option 'separate-log-files)) + (do-measurements (ly:get-option 'dump-profile)) (handler (lambda (key failed-file) (set! failed (append (list failed-file) failed))))) + (gc) (for-each (lambda (x) - - ;; We don't carry info across file boundaries - (if first - (set! first #f) - (gc)) + (let* + ((start-measurements (if do-measurements + (profile-measurements) + #f)) + (base (basename x ".ly")) + (all-settings (ly:all-options))) + + (if separate-logs + (ly:stderr-redirect (format "~a.log" base) "w")) + + (lilypond-file handler x) + (if start-measurements + (dump-profile x start-measurements (profile-measurements))) - (lilypond-file handler x) - (ly:clear-anonymous-modules) - (if (ly:get-option 'debug-gc) - (dump-gc-protects) - (if (= (random 40) 1) - (ly:reset-all-fonts)))) + (for-each + (lambda (s) + (ly:set-option (car s) (cdr s))) + all-settings) + + (ly:clear-anonymous-modules) + + (ly:set-option 'debug-gc-assert-parsed-dead #t) + (gc) + (ly:set-option 'debug-gc-assert-parsed-dead #f) + + + (if (ly:get-option 'debug-gc) + (dump-gc-protects) + (if (= (random 40) 1) + (ly:reset-all-fonts))))) files) + + ;; we want the failed-files notice in the aggregrate logfile. + (if (ly:get-option 'separate-logs) + (ly:stderr-redirect + (if (string-or-symbol? (ly:get-option 'log-file)) + (format "~a.log" (ly:get-option 'log-file)) + "/dev/tty") "a")) + + (if (ly:get-option 'dump-profile) + (dump-profile "lily-run-total" '(0 0) (profile-measurements))) + failed)) (define (lilypond-file handler file-name)