OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-binutils/] [binutils-2.19.1/] [cgen/] [profile.scm] - Rev 6

Compare with Previous | Blame | View Log

;;; {Profile}
;;; Copyright (C) 2009 Red Hat, Inc.
;;; This file is part of CGEN.
;;; See file COPYING.CGEN for details.
;;;
;;; This code is just an experimental prototype (e. g., it is not
;;; thread safe), but since it's at the same time useful, it's
;;; included anyway.
;;;
;;; This is copied from the tracing support in debug.scm.
;;; If merged into the main distribution it will need an efficiency
;;; and layout cleanup pass.
; FIXME: Prefix "proc-" added to not collide with cgen stuff.
; Put this stuff in the debug module since we need the trace facilities.
"profile: Wrong type argument:"; `trace' is a magic property understood by guile
; Subroutine of profile-entry to find the calling procedure.
; Result is name of calling procedure or #f.
; ??? Not sure this is right.  The goal is to find the real "caller".
;(or (frame-real? prev) (not (frame-evaluating-args? prev)))
; Return the current time.
; The result is a black box understood only by elapsed-time.
; Return the elapsed time in milliseconds since START.
; Handle invocation of profiled procedures.
; procedure-property returns #f if property not present
; SCM_TRACE_P is reset each time by the interpreter
;(display "entry\n" (current-error-port))
;; It's not necessary to call the continuation since
;; execution will continue if the handler returns
;(cont #f)
; Handle exiting of profiled procedures.
;(display "exit\n" (current-error-port))
; ??? Need to research if we have to do this or not.
; SCM_TRACE_P is reset each time by the interpreter
; Called before something is to be profiled.
; All desired procedures to be profiled must have been previously selected.
; Property `profile-count' is an association list of caller name and call
; count.
; ??? Will eventually want to use a hash table or some such.
; Called after execution to print profile counts.
; If ARGS contains 'all, stats on all profiled procs are printed, not just
; those that were actually called.
"Profiling results:\n\n"; Print the procs in sorted order.
; Print by decreasing frequency.
"\n""  "" ""\n""  "" -- total\n\n"

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.