|
|
@@ -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))
|