Bladeren bron

checkpoint

Mark VandenBrink 12 jaren geleden
bovenliggende
commit
b1d5090713
3 gewijzigde bestanden met toevoegingen van 18 en 19 verwijderingen
  1. 0 8
      mp4-atom.lisp
  2. 13 9
      profile.lisp
  3. 5 2
      utils.lisp

+ 0 - 8
mp4-atom.lisp

@@ -51,14 +51,6 @@
   (string-upcase (concatenate 'string "atom-" (as-string name))))
 (utils:memoize 'mk-atom-class-name)
 
-;; (defmethod as-string ((atom-type integer))
-;;   "Given an integer representing an atom type, return the string form"
-;;   (with-output-to-string (s nil)
-;;     (write-char (code-char (ldb (byte 8 24) atom-type)) s)
-;;     (write-char (code-char (ldb (byte 8 16) atom-type)) s)
-;;     (write-char (code-char (ldb (byte 8 8)  atom-type)) s)
-;;     (write-char (code-char (ldb (byte 8 0)  atom-type)) s)))
-
 (eval-when (:compile-toplevel :load-toplevel :execute)
   (defun as-octet (c)
     "Used below so that we can create atom 'types' from char/ints"

+ 13 - 9
profile.lisp

@@ -1,10 +1,9 @@
 ;;; -*- Mode: Lisp;  show-trailing-whitespace: t; Base: 10; indent-tabs: nil; Syntax: ANSI-Common-Lisp; Package: PROFILE; -*-
 ;;; Copyright (c) 2013, Mark VandenBrink. All rights reserved.
 
-;;;;;;;;;;;;;;;;;;;; Handy, dandy CCL profile functions ;;;;;;;;;;;;;;;;;;;;
-;;;
-;;; Usage: load and compile this file, then at REPL, type "profile:on".  After
-;;; running programs, type "profile:report" to get a profile listing.
+;;;;;;;;;;;;;;;;;;;; Handy, dandy profile functions ;;;;;;;;;;;;;;;;;;;;
+;;; "profile:on" enables profiling for taglib modules
+;;; "profile:report" shows a profile listing
 ;;; "profile:reset" clears counters
 ;;; "profile:off" turns off profiling
 (in-package #:profile)
@@ -16,11 +15,16 @@
 
 #+CCL (progn
         (defun on ()
-          (dolist (p '("MP4-ATOM" "MPEG" "AUDIO-STREAMS" "ID3-FRAME" "UTILS" "LOGGING" "ISO-639-2" "ABSTRACT-TAG" "FLAC-FRAME"))
-            (let ((pkg (find-package p)))
-              (mon:monitor-all pkg)
-              (format t "Package ~a, ~:d~%" pkg (length mon:*monitored-functions*))))
-          (format t "~&~&WARNING: YOU MUST TURN PROFILING OFF BEFORE RECOMPILING LIBRARY!!!~%"))
+          (let ((last-len 0)
+                (cur-len 0))
+            (dolist (p '("MP4-ATOM" "MPEG" "AUDIO-STREAMS" "ID3-FRAME" "UTILS" "ISO-639-2" "ABSTRACT-TAG" "FLAC-FRAME"))
+              (let ((pkg (find-package p)))
+                (mon:monitor-all pkg)
+                (setf cur-len (length mon:*monitored-functions*))
+                (format t "~4d functions/methods being monitored in package ~a~%" (- cur-len last-len) p)
+                (setf last-len cur-len)))
+            (format t "~4d total functions/methods being monitored~%" last-len))
+          (format t "~&~%~%~%~&WARNING: you MUST turn profiling off before recompiling library, or weirdness will ensue!!!~%~%"))
 
         (defun report (&key (sort-key :percent-time) (nested :exclusive))
           (mon:report :sort-key sort-key :nested nested :threshold 0.0 :names :all))

+ 5 - 2
utils.lisp

@@ -78,14 +78,17 @@ The above will expand to (ash (logand #xFFFBB240 #xFFE00000) -21) at COMPILE tim
   `(aif ,test-form
         (progn ,@body)))
 
+;;;(defvar *hashes* nil)
 (defun mk-memoize (func)
   "Takes a normal function object and returns a memoized one"
-  (let* (;(count 0)
+  (let* ((count 0)
          (hash-table (make-hash-table :test 'equal)))
+    ;;(push hash-table *hashes*)
+    ;;(format t "Hashes now: ~a~%" *hashes*)
     #'(lambda (arg)
         ;;(format t "Looking for <~a>~%" arg)
         (multiple-value-bind (value foundp) (gethash arg hash-table)
-          ;;(incf count)
+        (incf count)
 
           ;; (when (> count 20)
           ;;   (break "Breaking as requested")