aboutsummaryrefslogtreecommitdiff
path: root/module/entry-points/benchmark.scm
blob: ae55aa26ee8eac8948602b30008c6960c72d0b74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(define-module (entry-points benchmark)
  :export (main)

  :use-module (ice-9 getopt-long)
  :use-module (util options)
  :use-module (util)
  :use-module (util app)
  )


(define opt-spec
  `((field (value #t)
           (description
            "Which field from the current app to force. Most heavy fields are defined in "
            (i "(vcomponent)") ". Required."))
    (enable-output (single-char #\o)
                   (description
                    "Output is be default supressed, since many fields contain way to much data "
                    "to read. This turns it on again."))
    (help (single-char #\h) (description "Print this help."))))


(define (main args)
  (define opts (getopt-long args (getopt-opt opt-spec)))

  (define field (and=> (option-ref opts 'field #f) string->symbol))

  (when (option-ref opts 'help #f)
    (print-arg-help opt-spec)
    (throw 'return))

  (unless field
   (throw 'argument-error "Field `field' required."))

  (aif (option-ref opts 'enable-output #f)
       (write (getf field app: (current-app)))
       (getf field app: (current-app))))