#!hacchpsimguile -b
!#
;; "critical-path-verbose.hacchpsimscm"
;; common analysis routines
;; vi: ft=scheme
;;	$Id: critical-path-verbose.hacchpsimscm,v 1.5 2008/05/08 04:34:39 fang Exp $

;; don't call this script directly, but load me from another

(use-modules (hackt chpsim-trace))
(use-modules (hackt chpsim-primitives))
(use-modules (hackt hackt))
; (use-modules (hackt chpsim))
; (use-modules (hackt algorithm)) ; for list-flatten
(use-modules (hackt rb-tree))
(use-modules (hackt streams))
(use-modules (ice-9 streams))

(display "processing tracefile: ")
(display trace-name)
(newline)

(define trace-stream (open-chpsim-trace-stream trace-name))

(define crit (chpsim-trace-critical-path trace-name))

(display "critical-path (verbose):\n")
(stream-for-each display-trace-entry-verbose crit)
(newline)

(display "critical-event histogram:\n")
(define crit-histo (make-critical-event-histogram crit))
(rb-tree/for-each-display-newline crit-histo)
(newline)

(display "critical-process histogram:\n")
(define proc-histo (make-critical-process-histogram crit))
(print-named-critical-process-histogram proc-histo)
(newline)


