(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:tracing)
          op: Equal
          rhs: {(/sys/kernel/debug/tracing)}
          spids: [124]
        )
      ]
      spids: [124]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:flock)
          op: Equal
          rhs: {(/var/tmp/.ftrace-lock)}
          spids: [127]
        )
      ]
      spids: [127]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:bufsize_kb) op:Equal rhs:{(4096)} spids:[130])]
      spids: [130]
    )
    (Sentence
      child: 
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:opt_device) op:Equal rhs:{(0)} spids:[133])]
          spids: [133]
        )
      terminator: <Op_Semi ";">
    )
    (Sentence
      child: 
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:device) op:Equal rhs:{(SQ )} spids:[137])]
          spids: [137]
        )
      terminator: <Op_Semi ";">
    )
    (Sentence
      child: 
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:opt_iotype) op:Equal rhs:{(0)} spids:[140])]
          spids: [140]
        )
      terminator: <Op_Semi ";">
    )
    (Sentence
      child: 
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:iotype) op:Equal rhs:{(SQ )} spids:[144])]
          spids: [144]
        )
      terminator: <Op_Semi ";">
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:opt_timestamp) op:Equal rhs:{(0)} spids:[147])]
      spids: [147]
    )
    (Sentence
      child: 
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:opt_interval) op:Equal rhs:{(0)} spids:[150])]
          spids: [150]
        )
      terminator: <Op_Semi ";">
    )
    (Sentence
      child: 
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:interval) op:Equal rhs:{(1)} spids:[154])]
          spids: [154]
        )
      terminator: <Op_Semi ";">
    )
    (Sentence
      child: 
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:opt_count) op:Equal rhs:{(0)} spids:[158])]
          spids: [158]
        )
      terminator: <Op_Semi ";">
    )
    (Sentence
      child: 
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:count) op:Equal rhs:{(0)} spids:[162])]
          spids: [162]
        )
      terminator: <Op_Semi ";">
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:opt_queue) op:Equal rhs:{(0)} spids:[166])]
      spids: [166]
    )
    (C {(trap)} {(SQ <":">)} {(INT)} {(QUIT)} {(TERM)} {(PIPE)} {(HUP)})
    (FuncDef
      name: usage
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (HereDoc
                  op_id: Redir_DLessDash
                  fd: -1
                  body: 
                    {
                      (DQ ("USAGE: iolatency [-hQT] [-d device] [-i iotype] [interval [count]]\n") 
                        ("                 -d device       # device string (eg, ") (Right_DoubleQuote "\"") ("202,1)\n") 
                        (
"                 -i iotype       # match type (eg, '*R*' for all reads)\n"
                        ) ("                 -Q              # use queue insert as start time\n") 
                        ("                 -T              # timestamp on output\n") ("                 -h              # this usage message\n") 
                        (
"                 interval        # summary interval, seconds (default 1)\n"
                        ) ("                 count           # number of summaries\n") ("  eg,\n") 
                        ("       iolatency                 # summarize latency every second\n") ("       iolatency -Q              # include block I/O queue time\n") 
                        ("       iolatency 5 2             # 2 x 5 second summaries\n") ("       iolatency -i '*R*'        # trace reads\n") 
                        ("       iolatency -d 202,1        # trace device 202,1 only\n") ("\n") ("See the man page and example file for more info.\n")
                      )
                    }
                  do_expansion: True
                  here_end: END
                  was_filled: True
                  spids: [198]
                )
                (Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[201])
              ]
            )
            (C {(exit)})
          ]
          spids: [193]
        )
      spids: [189 192]
    )
    (FuncDef
      name: warn
      body: 
        (BraceGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: (Pipeline children:[(C {(eval)} {(DQ ($ VSub_At "$@"))})] negated:True)
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [
                        {(echo)}
                        {
                          (DQ ("WARNING: command failed ") 
                            (EscapedLiteralPart
                              token: <Lit_EscapedChar "\\\"">
                            ) ($ VSub_At "$@") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">)
                          )
                        }
                      ]
                      redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[251])]
                    )
                  ]
                  spids: [-1 246]
                )
              ]
              spids: [-1 262]
            )
          ]
          spids: [232]
        )
      spids: [228 231]
    )
    (FuncDef
      name: end
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(echo)}]
              redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[280])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("Ending tracing..."))}]
              redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[290])]
            )
            (C {(cd)} {($ VSub_Name "$tracing")})
            (C {(warn)} {(DQ ("echo 0 > events/block/") ($ VSub_Name "$b_start") (/enable))})
            (C {(warn)} {(DQ ("echo 0 > events/block/block_rq_complete/enable"))})
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DParen
                          child: 
                            (ArithBinary
                              op_id: Arith_DPipe
                              left: (ArithVarRef name:opt_device)
                              right: (ArithVarRef name:opt_iotype)
                            )
                        )
                      terminator: <Op_Semi ";">
                    )
                  ]
                  action: [
                    (C {(warn)} {(DQ ("echo 0 > events/block/") ($ VSub_Name "$b_start") (/filter))})
                    (C {(warn)} {(DQ ("echo 0 > events/block/block_rq_complete/filter"))})
                  ]
                  spids: [-1 329]
                )
              ]
              spids: [-1 348]
            )
            (C {(warn)} {(DQ ("echo > trace"))})
            (AndOr
              children: [
                (DParen child:(ArithVarRef name:wroteflock))
                (C {(warn)} {(DQ ("rm ") ($ VSub_Name "$flock"))})
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [271]
        )
      spids: [267 270]
    )
    (FuncDef
      name: die
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_At "$@"))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[386])]
            )
            (C {(exit)} {(1)})
          ]
          spids: [381]
        )
      spids: [377 380]
    )
    (FuncDef
      name: edie
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_At "$@"))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[414])]
            )
            (SimpleCommand
              words: [{(exec)}]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[424])
                (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[427])
              ]
            )
            (C {(end)})
            (C {(exit)} {(1)})
          ]
          spids: [405]
        )
      spids: [401 404]
    )
    (While
      cond: [(C {(getopts)} {(d) (Lit_Other ":") (hi) (Lit_Other ":") (QT)} {(opt)})]
      body: 
        (DoGroup
          children: [
            (Case
              to_match: {($ VSub_Name "$opt")}
              arms: [
                (case_arm
                  pat_list: [{(d)}]
                  action: [
                    (Sentence
                      child: 
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:opt_device)
                              op: Equal
                              rhs: {(1)}
                              spids: [469]
                            )
                          ]
                          spids: [469]
                        )
                      terminator: <Op_Semi ";">
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:device)
                          op: Equal
                          rhs: {($ VSub_Name "$OPTARG")}
                          spids: [473]
                        )
                      ]
                      spids: [473]
                    )
                  ]
                  spids: [466 467 476 -1]
                )
                (case_arm
                  pat_list: [{(i)}]
                  action: [
                    (Sentence
                      child: 
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:opt_iotype)
                              op: Equal
                              rhs: {(1)}
                              spids: [482]
                            )
                          ]
                          spids: [482]
                        )
                      terminator: <Op_Semi ";">
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:iotype)
                          op: Equal
                          rhs: {($ VSub_Name "$OPTARG")}
                          spids: [486]
                        )
                      ]
                      spids: [486]
                    )
                  ]
                  spids: [479 480 489 -1]
                )
                (case_arm
                  pat_list: [{(Q)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:opt_queue)
                          op: Equal
                          rhs: {(1)}
                          spids: [495]
                        )
                      ]
                      spids: [495]
                    )
                  ]
                  spids: [492 493 498 -1]
                )
                (case_arm
                  pat_list: [{(T)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:opt_timestamp)
                          op: Equal
                          rhs: {(1)}
                          spids: [504]
                        )
                      ]
                      spids: [504]
                    )
                  ]
                  spids: [501 502 507 -1]
                )
                (case_arm
                  pat_list: [{(h)} {(Lit_Other "?")}]
                  action: [(C {(usage)})]
                  spids: [510 513 517 -1]
                )
              ]
              spids: [459 463 520]
            )
          ]
          spids: [456 522]
        )
    )
    (C {(shift)} 
      {
        (ArithSubPart
          anode: 
            (ArithBinary
              op_id: Arith_Minus
              left: (ArithWord w:{($ VSub_Name "$OPTIND")})
              right: (ArithWord w:{(Lit_Digits 1)})
            )
          spids: [526 535]
        )
      }
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (DParen child:(ArithWord w:{($ VSub_Pound "$#")}))
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:opt_interval) op:Equal rhs:{(1)} spids:[550])]
              spids: [550]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:interval)
                  op: Equal
                  rhs: {($ VSub_Number "$1")}
                  spids: [554]
                )
              ]
              spids: [554]
            )
            (C {(shift)})
          ]
          spids: [-1 547]
        )
      ]
      spids: [-1 560]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (DParen child:(ArithWord w:{($ VSub_Pound "$#")}))
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:opt_count) op:Equal rhs:{(1)} spids:[575])]
              spids: [575]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:count)
                  op: Equal
                  rhs: {($ VSub_Number "$1")}
                  spids: [579]
                )
              ]
              spids: [579]
            )
          ]
          spids: [-1 572]
        )
      ]
      spids: [-1 582]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (DParen child:(ArithVarRef name:opt_device))
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:major)
                  op: Equal
                  rhs: 
                    {
                      (BracedVarSub
                        token: <VSub_Name device>
                        suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(",*")})
                        spids: [598 602]
                      )
                    }
                  spids: [597]
                )
              ]
              spids: [597]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:minor)
                  op: Equal
                  rhs: 
                    {
                      (BracedVarSub
                        token: <VSub_Name device>
                        suffix_op: (StringUnary op_id:VOp1_Pound arg_word:{("*,")})
                        spids: [606 610]
                      )
                    }
                  spids: [605]
                )
              ]
              spids: [605]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:dev)
                  op: Equal
                  rhs: 
                    {
                      (ArithSubPart
                        anode: 
                          (ArithBinary
                            op_id: Arith_Plus
                            left: 
                              (ArithBinary
                                op_id: Arith_DLess
                                left: (ArithVarRef name:major)
                                right: (ArithWord w:{(Lit_Digits 20)})
                              )
                            right: (ArithVarRef name:minor)
                          )
                        spids: [614 629]
                      )
                    }
                  spids: [613]
                )
              ]
              spids: [613]
            )
          ]
          spids: [-1 594]
        )
      ]
      spids: [-1 631]
    )
    (If
      arms: [
        (if_arm
          cond: [(Sentence child:(DParen child:(ArithVarRef name:opt_queue)) terminator:<Op_Semi ";">)]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:b_start)
                  op: Equal
                  rhs: {(block_rq_insert)}
                  spids: [646]
                )
              ]
              spids: [646]
            )
          ]
          spids: [-1 643]
        )
      ]
      else_action: [
        (Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (LhsName name:b_start)
              op: Equal
              rhs: {(block_rq_issue)}
              spids: [652]
            )
          ]
          spids: [652]
        )
      ]
      spids: [649 655]
    )
    (AndOr
      children: [
        (DBracket expr:(BoolUnary op_id:BoolUnary_x child:{(/usr/bin/mawk)}))
        (AndOr
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:awk)
                  op: Equal
                  rhs: {(SQ <"mawk -W interactive">)}
                  spids: [671]
                )
              ]
              spids: [671]
            )
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:awk) op:Equal rhs:{(awk)} spids:[678])]
              spids: [678]
            )
          ]
          op_id: Op_DPipe
        )
      ]
      op_id: Op_DAmp
    )
    (AndOr
      children: [
        (C {(cd)} {($ VSub_Name "$tracing")})
        (C {(die)} 
          {
            (DQ ("ERROR: accessing tracing. Root user? Kernel has FTRACE?\n") 
              ("    debugfs mounted? (mount -t debugfs debugfs /sys/kernel/debug)")
            )
          }
        )
      ]
      op_id: Op_DPipe
    )
    (AndOr
      children: [
        (DBracket expr:(BoolUnary op_id:BoolUnary_e child:{($ VSub_Name "$flock")}))
        (C {(die)} 
          {
            (DQ ("ERROR: ftrace may be in use by PID ") 
              (CommandSubPart
                command_list: (CommandList children:[(C {(cat)} {($ VSub_Name "$flock")})])
                left_token: <Left_CommandSub "$(">
                spids: [716 720]
              ) (" ") ($ VSub_Name "$flock")
            )
          }
        )
      ]
      op_id: Op_DAmp
    )
    (AndOr
      children: [
        (SimpleCommand
          words: [{(echo)} {($ VSub_Dollar "$$")}]
          redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{($ VSub_Name "$flock")} spids:[729])]
        )
        (C {(die)} {(DQ ("ERROR: unable to write ") ($ VSub_Name "$flock") (.))})
      ]
      op_id: Op_DPipe
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:wroteflock) op:Equal rhs:{(1)} spids:[743])]
      spids: [743]
    )
    (C {(warn)} {(DQ ("echo nop > current_tracer"))})
    (C {(warn)} {(DQ ("echo ") ($ VSub_Name "$bufsize_kb") (" > buffer_size_kb"))})
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:filter) op:Equal rhs:{(SQ )} spids:[764])]
      spids: [764]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (DParen child:(ArithVarRef name:opt_iotype))
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:filter)
                  op: Equal
                  rhs: 
                    {
                      (DQ ("rwbs ~ ") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) 
                        ($ VSub_Name "$iotype") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">)
                      )
                    }
                  spids: [779]
                )
              ]
              spids: [779]
            )
          ]
          spids: [-1 776]
        )
      ]
      spids: [-1 787]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (DParen child:(ArithVarRef name:opt_device))
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (AndOr
              children: [
                (DBracket
                  expr: (BoolBinary op_id:BoolBinary_GlobNEqual left:{(DQ ($ VSub_Name "$filter"))} right:{(DQ )})
                )
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:filter)
                      op: Equal
                      rhs: {(DQ ($ VSub_Name "$filter") (" && "))}
                      spids: [817]
                    )
                  ]
                  spids: [817]
                )
              ]
              op_id: Op_DAmp
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:filter)
                  op: Equal
                  rhs: {(DQ (${ VSub_Name filter) ("dev == ") ($ VSub_Name "$dev"))}
                  spids: [824]
                )
              ]
              spids: [824]
            )
          ]
          spids: [-1 799]
        )
      ]
      spids: [-1 833]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DParen
                  child: 
                    (ArithBinary
                      op_id: Arith_DPipe
                      left: (ArithVarRef name:opt_iotype)
                      right: (ArithVarRef name:opt_device)
                    )
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (AndOr
                      children: [
                        (Pipeline
                          children: [
                            (SimpleCommand
                              words: [{(echo)} {(DQ ($ VSub_Name "$filter"))}]
                              redirects: [
                                (Redir
                                  op_id: Redir_Great
                                  fd: -1
                                  arg_word: {(events/block/) ($ VSub_Name "$b_start") (/filter)}
                                  spids: [862]
                                )
                              ]
                            )
                          ]
                          negated: True
                        )
                        (Pipeline
                          children: [
                            (SimpleCommand
                              words: [{(echo)} {(DQ ($ VSub_Name "$filter"))}]
                              redirects: [
                                (Redir
                                  op_id: Redir_Great
                                  fd: -1
                                  arg_word: {(events/block/block_rq_complete/filter)}
                                  spids: [880]
                                )
                              ]
                            )
                          ]
                          negated: True
                        )
                      ]
                      op_id: Op_DPipe
                    )
                  ]
                  action: [(C {(edie)} {(DQ ("ERROR: setting -d or -t filter. Exiting."))})]
                  spids: [-1 885]
                )
              ]
              spids: [-1 895]
            )
          ]
          spids: [-1 849]
        )
      ]
      spids: [-1 897]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (AndOr
                  children: [
                    (Pipeline
                      children: [
                        (SimpleCommand
                          words: [{(echo)} {(1)}]
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: -1
                              arg_word: {(events/block/) ($ VSub_Name "$b_start") (/enable)}
                              spids: [907]
                            )
                          ]
                        )
                      ]
                      negated: True
                    )
                    (Pipeline
                      children: [
                        (SimpleCommand
                          words: [{(echo)} {(1)}]
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: -1
                              arg_word: {(events/block/block_rq_complete/enable)}
                              spids: [923]
                            )
                          ]
                        )
                      ]
                      negated: True
                    )
                  ]
                  op_id: Op_DPipe
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [(C {(edie)} {(DQ ("ERROR: enabling block I/O tracepoints. Exiting."))})]
          spids: [-1 928]
        )
      ]
      spids: [-1 937]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:etext) op:Equal rhs:{(SQ )} spids:[939])]
      spids: [939]
    )
    (AndOr
      children: [
        (DParen child:(ArithUnary op_id:Arith_Bang child:(ArithVarRef name:opt_count)))
        (Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (LhsName name:etext)
              op: Equal
              rhs: {(DQ (" Ctrl-C to end."))}
              spids: [951]
            )
          ]
          spids: [951]
        )
      ]
      op_id: Op_DAmp
    )
    (C {(echo)} 
      {
        (DQ ("Tracing block I/O. Output every ") ($ VSub_Name "$interval") (" seconds.") 
          ($ VSub_Name "$etext")
        )
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:offset)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (C {($ VSub_Name "$awk")} 
                        {
                          (SQ <"BEGIN { o = 0; }\n"> 
                            <"\t$1 == \"#\" && $2 ~ /TASK/ && NF == 6 { o = 1; }\n"> <"\t$2 ~ /TASK/ { print o; exit }">
                          )
                        } {(trace)}
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [988 998]
              )
            }
          spids: [987]
        )
      ]
      spids: [987]
    )
    (C {(warn)} {(DQ ("echo > trace"))})
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:i) op:Equal rhs:{(0)} spids:[1010])]
      spids: [1010]
    )
    (Pipeline
      children: [
        (While
          cond: [
            (Sentence
              child: 
                (DParen
                  child: 
                    (ArithBinary
                      op_id: Arith_DPipe
                      left: (ArithUnary op_id:Arith_Bang child:(ArithVarRef name:opt_count))
                      right: 
                        (ArithBinary
                          op_id: Arith_Less
                          left: (ArithVarRef name:i)
                          right: (ArithVarRef name:count)
                        )
                    )
                )
              terminator: <Op_Semi ";">
            )
          ]
          body: 
            (DoGroup
              children: [
                (DParen
                  child: (UnaryAssign op_id:Node_PostDPlus child:(LhsName name:i))
                )
                (C {(sleep)} {($ VSub_Name "$interval")})
                (If
                  arms: [
                    (if_arm
                      cond: [
                        (Sentence
                          child: (DBracket expr:(BoolUnary op_id:BoolUnary_x child:{(snapshot)}))
                          terminator: <Op_Semi ";">
                        )
                      ]
                      action: [
                        (SimpleCommand
                          words: [{(echo)} {(1)}]
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: -1
                              arg_word: {(snapshot)}
                              spids: [1074]
                            )
                          ]
                        )
                        (SimpleCommand
                          words: [{(echo)}]
                          redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(trace)} spids:[1081])]
                        )
                        (C {(cat)} {(snapshot)})
                      ]
                      spids: [-1 1067]
                    )
                  ]
                  else_action: [
                    (C {(cat)} {(trace)})
                    (SimpleCommand
                      words: [{(echo)}]
                      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(trace)} spids:[1101])]
                    )
                  ]
                  spids: [1091 1106]
                )
                (AndOr
                  children: [
                    (DParen child:(ArithVarRef name:opt_timestamp))
                    (C {(printf)} 
                      {(DQ ("time %(%H:%M:%S)T:") (EscapedLiteralPart token:<Lit_EscapedChar "\\n">))} {(-1)}
                    )
                  ]
                  op_id: Op_DAmp
                )
                (C {(echo)} {(DQ (tick))})
              ]
              spids: [1034 1135]
            )
        )
        (C {($ VSub_Name "$awk")} {(-v)} {(Lit_VarLike "o=") ($ VSub_Name "$offset")} {(-v)} 
          {(Lit_VarLike "opt_timestamp=") ($ VSub_Name "$opt_timestamp")} {(-v)} {(Lit_VarLike "b_start=") ($ VSub_Name "$b_start")} 
          {
            (SQ <"\n"> <"\tfunction star(sval, smax, swidth) {\n"> <"\t\tstars = \"\"\n"> 
              <"\t\tif (smax == 0) return \"\"\n"> <"\t\tfor (si = 0; si < (swidth * sval / smax); si++) {\n"> <"\t\t\tstars = stars \"#\"\n"> <"\t\t}\n"> 
              <"\t\treturn stars\n"> <"\t}\n"> <"\n"> <"\tBEGIN { max_i = 0 }\n"> <"\n"> <"\t# common fields\n"> <"\t$1 != \"#\" {\n"> 
              <"\t\ttime = $(3+o); sub(\":\", \"\", time)\n"> <"\t\tdev = $(5+o)\n"> <"\t}\n"> <"\n"> <"\t# block I/O request\n"> <"\t$1 != \"#\" && $0 ~ b_start {\n"> 
              <"\t\t#\n"> <"\t\t# example: (fields1..4+o) 202,1 W 0 () 12862264 + 8 [tar]\n"> 
              <"\t\t# The cmd field \"()\" might contain multiple words (hex),\n"> <"\t\t# hence stepping from the right (NF-3).\n"> <"\t\t#\n"> <"\t\tloc = $(NF-3)\n"> 
              <"\t\tstarts[dev, loc] = time\n"> <"\t\tnext\n"> <"\t}\n"> <"\n"> <"\t# block I/O completion\n"> 
              <"\t$1 != \"#\" && $0 ~ /rq_complete/ {\n"> <"\t\t#\n"> <"\t\t# example: (fields1..4+o) 202,1 W () 12862256 + 8 [0]\n"> <"\t\t#\n"> 
              <"\t\tdir = $(6+o)\n"> <"\t\tloc = $(NF-3)\n"> <"\n"> <"\t\tif (starts[dev, loc] > 0) {\n"> 
              <"\t\t\tlatency_ms = 1000 * (time - starts[dev, loc])\n"> <"\t\t\ti = 0\n"> <"\t\t\tfor (ms = 1; latency_ms > ms; ms *= 2) { i++ }\n"> <"\t\t\thist[i]++\n"> 
              <"\t\t\tif (i > max_i)\n"> <"\t\t\t\tmax_i = i\n"> <"\t\t\tdelete starts[dev, loc]\n"> <"\t\t}\n"> <"\t\tnext\n"> <"\t}\n"> <"\n"> 
              <"\t# timestamp\n"> <"\t$1 == \"time\" {\n"> <"\t\tlasttime = $2\n"> <"\t}\n"> <"\n"> <"\t# print summary\n"> 
              <"\t$1 == \"tick\" {\n"> <"\t\tprint \"\"\n"> <"\t\tif (opt_timestamp)\n"> <"\t\t\tprint lasttime\n"> <"\n"> 
              <"\t\t# find max value\n"> <"\t\tmax_v = 0\n"> <"\t\tfor (i = 0; i <= max_i; i++) {\n"> <"\t\t\tif (hist[i] > max_v)\n"> 
              <"\t\t\t\tmax_v = hist[i]\n"> <"\t\t}\n"> <"\n"> <"\t\t# print histogram\n"> 
              <"\t\tprintf \"%8s .. %-8s: %-8s |%-38s|\\n\", \">=(ms)\", \"<(ms)\",\n"> <"\t\t    \"I/O\", \"Distribution\"\n"> <"\t\tms = 1\n"> <"\t\tfrom = 0\n"> 
              <"\t\tfor (i = 0; i <= max_i; i++) {\n"> <"\t\t\tprintf \"%8d -> %-8d: %-8d |%-38s|\\n\", from, ms,\n"> 
              <"\t\t\t    hist[i], star(hist[i], max_v, 38)\n"> <"\t\t\tfrom = ms\n"> <"\t\t\tms *= 2\n"> <"\t\t}\n"> <"\t\tfflush()\n"> <"\t\tdelete hist\n"> 
              <"\t\tdelete starts\t# invalid if events missed between snapshots\n"> <"\t\tmax_i = 0\n"> <"\t}\n"> <"\n"> 
              <"\t$0 ~ /LOST.*EVENTS/ { print \"WARNING: \" $0 > \"/dev/stderr\" }\n">
            )
          }
        )
      ]
      negated: False
    )
    (C {(end)})
  ]
)