profile.lisp 984 B

12345678910111213141516171819202122232425
  1. ;;; -*- Mode: Lisp; show-trailing-whitespace: t; Base: 10; indent-tabs: nil; Syntax: ANSI-Common-Lisp; Package: CL-USER; -*-
  2. ;;; Copyright (c) 2013, Mark VandenBrink. All rights reserved.
  3. ;;;;;;;;;;;;;;;;;;;; Handy, dandy CCL profile functions ;;;;;;;;;;;;;;;;;;;;
  4. ;;;
  5. ;;; Usage: load and compile this file, then at REPL, type "profile-on". After
  6. ;;; running programs, type "profile-report" to get a profile listing.
  7. ;;; "profile-reset" clears counters
  8. ;;; "profil-off" turns of profiling
  9. (in-package #:cl-user)
  10. (defun profile-on ()
  11. (dolist (p '("MP4-ATOM" "MPEG" "AUDIO-STREAMS" "ID3-FRAME" "UTILS" "LOGGING" "ISO-639-2" "ABSTRACT-TAG" "FLAC-FRAME"))
  12. (let ((pkg (find-package p)))
  13. (mon:monitor-all pkg)
  14. (format t "Package ~a, ~:d~%" pkg (length mon:*monitored-functions*)))))
  15. (defun profile-report ()
  16. (mon:report :nested :inclusive :threshold 0.0 :names :all))
  17. (defun profile-reset ()
  18. (mon:reset-all-monitoring))
  19. (defun profile-off ()
  20. (mon:unmonitor))