;;-*-Lisp-*-
(in-package goal)

;; this file is debug only
(declare-file (debug))
(when *debug-segment*
;; definition of type memory-usage-info
(deftype memory-usage-info (structure)
  ((name  string  :offset-assert   0)
   (count int32   :offset-assert   4)
   (used  int32   :offset-assert   8)
   (total int32   :offset-assert  12)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type memory-usage-info
(defmethod inspect memory-usage-info ((obj memory-usage-info))
  (format #t "[~8x] ~A~%" obj 'memory-usage-info)
  (format #t "~Tname: ~A~%" (-> obj name))
  (format #t "~Tcount: ~D~%" (-> obj count))
  (format #t "~Tused: ~D~%" (-> obj used))
  (format #t "~Ttotal: ~D~%" (-> obj total))
  obj
  )

;; definition of type memory-usage-block
(deftype memory-usage-block (basic)
  ((work-bsp basic                         :offset-assert   4)
   (length   int32                         :offset-assert   8)
   (data     memory-usage-info 109 :inline :offset-assert  16)
   )
  :method-count-assert 12
  :size-assert         #x6e0
  :flag-assert         #xc000006e0
  (:methods
    (reset! (_type_) _type_ 9)
    (calculate-total (_type_) int 10)
    (print-mem-usage (_type_ level object) none 11)
    )
  )

;; definition for method 3 of type memory-usage-block
;; INFO: this function exists in multiple non-identical object files
(defmethod inspect memory-usage-block ((obj memory-usage-block))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Twork-bsp: ~A~%" (-> obj work-bsp))
  (format #t "~Tlength: ~D~%" (-> obj length))
  (format #t "~Tdata[109] @ #x~X~%" (-> obj data))
  obj
  )

;; definition for symbol *mem-usage*, type memory-usage-block
(define *mem-usage* (new 'debug 'memory-usage-block))

;; definition for symbol *dma-mem-usage*, type memory-usage-block
(define *dma-mem-usage* (new 'debug 'memory-usage-block))

;; definition for symbol *temp-mem-usage*, type memory-usage-block
(define *temp-mem-usage* (the-as memory-usage-block #f))

)
