(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tracing)
          op: Equal
          rhs: {(/sys/kernel/debug/tracing)}
        )
      ]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:flock) op:Equal rhs:{(/var/tmp/.ftrace-lock)})]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:bufsize_kb) op:Equal rhs:{(4096)})]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_device) op:Equal rhs:{(0)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:device) op:Equal rhs:(word.Empty))]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_iotype) op:Equal rhs:{(0)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:iotype) op:Equal rhs:(word.Empty))]
            )
          terminator: <Op_Semi ';'>
        )
        (command.ShAssignment
          pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_timestamp) op:Equal rhs:{(0)})]
        )
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_interval) op:Equal rhs:{(0)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:interval) op:Equal rhs:{(1)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_count) op:Equal rhs:{(0)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:count) op:Equal rhs:{(0)})]
            )
          terminator: <Op_Semi ';'>
        )
        (command.ShAssignment
          pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_queue) op:Equal rhs:{(0)})]
        )
      ]
    )
    (C {(trap)} {(SQ <':'>)} {(INT)} {(QUIT)} {(TERM)} {(PIPE)} {(HUP)})
    (command.ShFunction
      name: usage
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.HereDoc
                  op: <Redir_DLessDash '<<-'>
                  fd: 16777215
                  here_begin: {(END)}
                  here_end_span_id: 223
                  stdin_parts: [
                    ('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')
                  ]
                )
                (redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})
              ]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit>)
          ]
        )
    )
    (command.ShFunction
      name: warn
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [(C {(eval)} {(DQ ($ VSub_At '$@'))})]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Simple
                      words: [
                        {(echo)}
                        {
                          (DQ ('WARNING: command failed ') 
                            (word_part.EscapedLiteral
                              token: <Lit_EscapedChar '\\"'>
                            ) ($ VSub_At '$@') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>)
                          )
                        }
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: end
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{(echo)}]
              redirects: [(redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})]
            )
            (command.Simple
              words: [{(echo)} {(DQ ('Ending tracing...'))}]
              redirects: [(redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})]
            )
            (C {(cd)} {($ VSub_DollarName '$tracing')})
            (C {(warn)} {(DQ ('echo 0 > events/block/') ($ VSub_DollarName '$b_start') (/enable))})
            (C {(warn)} {(DQ ('echo 0 > events/block/block_rq_complete/enable'))})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DParen
                          child: 
                            (arith_expr.Binary
                              op_id: Arith_DPipe
                              left: (arith_expr.VarRef token:<Lit_ArithVarLike opt_device>)
                              right: (arith_expr.VarRef token:<Lit_ArithVarLike opt_iotype>)
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(warn)} 
                      {(DQ ('echo 0 > events/block/') ($ VSub_DollarName '$b_start') (/filter))}
                    )
                    (C {(warn)} {(DQ ('echo 0 > events/block/block_rq_complete/filter'))})
                  ]
                )
              ]
            )
            (C {(warn)} {(DQ ('echo > trace'))})
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (command.DParen
                  child: (arith_expr.VarRef token:<Lit_ArithVarLike wroteflock>)
                )
                (C {(warn)} {(DQ ('rm ') ($ VSub_DollarName '$flock'))})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: die
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{(echo)} {(DQ ($ VSub_At '$@'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
    )
    (command.ShFunction
      name: edie
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{(echo)} {(DQ ($ VSub_At '$@'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (command.Simple
              words: [{(exec)}]
              redirects: [
                (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})
                (redir.Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)})
              ]
            )
            (C {(end)})
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
    )
    (command.WhileUntil
      keyword: <KW_While while>
      cond: [(C {(getopts)} {(d) (Lit_Other ':') (hi) (Lit_Other ':') (QT)} {(opt)})]
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: {($ VSub_DollarName '$opt')}
              arms: [
                (case_arm
                  pat_list: [{(d)}]
                  action: [
                    (command.Sentence
                      child: 
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:opt_device)
                              op: Equal
                              rhs: {(1)}
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:device)
                          op: Equal
                          rhs: {($ VSub_DollarName '$OPTARG')}
                        )
                      ]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(i)}]
                  action: [
                    (command.Sentence
                      child: 
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:opt_iotype)
                              op: Equal
                              rhs: {(1)}
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:iotype)
                          op: Equal
                          rhs: {($ VSub_DollarName '$OPTARG')}
                        )
                      ]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(Q)}]
                  action: [
                    (command.ShAssignment
                      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_queue) op:Equal rhs:{(1)})]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(T)}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:opt_timestamp)
                          op: Equal
                          rhs: {(1)}
                        )
                      ]
                    )
                  ]
                )
                (case_arm pat_list:[{(h)} {(Lit_QMark '?')}] action:[(C {(usage)})])
              ]
            )
          ]
        )
    )
    (C {(shift)} 
      {
        (word_part.ArithSub
          anode: 
            (arith_expr.Binary
              op_id: Arith_Minus
              left: (arith_expr.ArithWord w:{($ VSub_DollarName '$OPTIND')})
              right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
            )
        )
      }
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.ArithWord w:{($ VSub_Pound '$#')}))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_interval) op:Equal rhs:{(1)})]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:interval)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                )
              ]
            )
            (C {(shift)})
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.ArithWord w:{($ VSub_Pound '$#')}))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_count) op:Equal rhs:{(1)})]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:count)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_device>))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:major)
                  op: Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <VSub_Name device>
                        suffix_op: (suffix_op.Unary op_id:VOp1_Percent arg_word:{(',*')})
                      )
                    }
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:minor)
                  op: Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <VSub_Name device>
                        suffix_op: (suffix_op.Unary op_id:VOp1_Pound arg_word:{('*,')})
                      )
                    }
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:dev)
                  op: Equal
                  rhs: 
                    {
                      (word_part.ArithSub
                        anode: 
                          (arith_expr.Binary
                            op_id: Arith_Plus
                            left: 
                              (arith_expr.Binary
                                op_id: Arith_DLess
                                left: (arith_expr.VarRef token:<Lit_ArithVarLike major>)
                                right: (arith_expr.ArithWord w:{(Lit_Digits 20)})
                              )
                            right: (arith_expr.VarRef token:<Lit_ArithVarLike minor>)
                          )
                      )
                    }
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_queue>))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:b_start)
                  op: Equal
                  rhs: {(block_rq_insert)}
                )
              ]
            )
          ]
        )
      ]
      else_action: [
        (command.ShAssignment
          pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:b_start) op:Equal rhs:{(block_rq_issue)})]
        )
      ]
    )
    (command.AndOr
      ops: [Op_DAmp Op_DPipe]
      children: [
        (command.DBracket expr:(bool_expr.Unary op_id:BoolUnary_x child:{(/usr/bin/mawk)}))
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:awk)
              op: Equal
              rhs: {(SQ <'mawk -W interactive'>)}
            )
          ]
        )
        (command.ShAssignment
          pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:awk) op:Equal rhs:{(awk)})]
        )
      ]
    )
    (command.AndOr
      ops: [Op_DPipe]
      children: [
        (C {(cd)} {($ VSub_DollarName '$tracing')})
        (C {(die)} 
          {
            (DQ ('ERROR: accessing tracing. Root user? Kernel has FTRACE?\n') 
              ('    debugfs mounted? (mount -t debugfs debugfs /sys/kernel/debug)')
            )
          }
        )
      ]
    )
    (command.AndOr
      ops: [Op_DAmp]
      children: [
        (command.DBracket
          expr: (bool_expr.Unary op_id:BoolUnary_e child:{($ VSub_DollarName '$flock')})
        )
        (C {(die)} 
          {
            (DQ ('ERROR: ftrace may be in use by PID ') 
              (command_sub
                left_token: <Left_DollarParen '$('>
                command_list: 
                  (command.CommandList
                    children: [(C {(cat)} {($ VSub_DollarName '$flock')})]
                  )
              ) (' ') ($ VSub_DollarName '$flock')
            )
          }
        )
      ]
    )
    (command.AndOr
      ops: [Op_DPipe]
      children: [
        (command.Simple
          words: [{(echo)} {($ VSub_Dollar '$$')}]
          redirects: [
            (redir.Redir
              op: <Redir_Great '>'>
              fd: 16777215
              arg_word: {($ VSub_DollarName '$flock')}
            )
          ]
        )
        (C {(die)} {(DQ ('ERROR: unable to write ') ($ VSub_DollarName '$flock') (.))})
      ]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:wroteflock) op:Equal rhs:{(1)})]
    )
    (C {(warn)} {(DQ ('echo nop > current_tracer'))})
    (C {(warn)} {(DQ ('echo ') ($ VSub_DollarName '$bufsize_kb') (' > buffer_size_kb'))})
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:filter) op:Equal rhs:(word.Empty))]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_iotype>))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filter)
                  op: Equal
                  rhs: 
                    {
                      (DQ ('rwbs ~ ') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) 
                        ($ VSub_DollarName '$iotype') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>)
                      )
                    }
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_device>))
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: BoolBinary_GlobNEqual
                      left: {(DQ ($ VSub_DollarName '$filter'))}
                      right: {(DQ )}
                    )
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:filter)
                      op: Equal
                      rhs: {(DQ ($ VSub_DollarName '$filter') (' && '))}
                    )
                  ]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filter)
                  op: Equal
                  rhs: {(DQ (${ VSub_Name filter) ('dev == ') ($ VSub_DollarName '$dev'))}
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DParen
                  child: 
                    (arith_expr.Binary
                      op_id: Arith_DPipe
                      left: (arith_expr.VarRef token:<Lit_ArithVarLike opt_iotype>)
                      right: (arith_expr.VarRef token:<Lit_ArithVarLike opt_device>)
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.AndOr
                      ops: [Op_DPipe]
                      children: [
                        (command.Pipeline
                          children: [
                            (command.Simple
                              words: [{(echo)} {(DQ ($ VSub_DollarName '$filter'))}]
                              redirects: [
                                (redir.Redir
                                  op: <Redir_Great '>'>
                                  fd: 16777215
                                  arg_word: {(events/block/) ($ VSub_DollarName '$b_start') (/filter)}
                                )
                              ]
                            )
                          ]
                          negated: T
                        )
                        (command.Pipeline
                          children: [
                            (command.Simple
                              words: [{(echo)} {(DQ ($ VSub_DollarName '$filter'))}]
                              redirects: [
                                (redir.Redir
                                  op: <Redir_Great '>'>
                                  fd: 16777215
                                  arg_word: {(events/block/block_rq_complete/filter)}
                                )
                              ]
                            )
                          ]
                          negated: T
                        )
                      ]
                    )
                  ]
                  action: [(C {(edie)} {(DQ ('ERROR: setting -d or -t filter. Exiting.'))})]
                )
              ]
            )
          ]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.AndOr
                  ops: [Op_DPipe]
                  children: [
                    (command.Pipeline
                      children: [
                        (command.Simple
                          words: [{(echo)} {(1)}]
                          redirects: [
                            (redir.Redir
                              op: <Redir_Great '>'>
                              fd: 16777215
                              arg_word: {(events/block/) ($ VSub_DollarName '$b_start') (/enable)}
                            )
                          ]
                        )
                      ]
                      negated: T
                    )
                    (command.Pipeline
                      children: [
                        (command.Simple
                          words: [{(echo)} {(1)}]
                          redirects: [
                            (redir.Redir
                              op: <Redir_Great '>'>
                              fd: 16777215
                              arg_word: {(events/block/block_rq_complete/enable)}
                            )
                          ]
                        )
                      ]
                      negated: T
                    )
                  ]
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(edie)} {(DQ ('ERROR: enabling block I/O tracepoints. Exiting.'))})]
        )
      ]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:etext) op:Equal rhs:(word.Empty))]
    )
    (command.AndOr
      ops: [Op_DAmp]
      children: [
        (command.DParen
          child: 
            (arith_expr.Unary
              op_id: Arith_Bang
              child: (arith_expr.VarRef token:<Lit_ArithVarLike opt_count>)
            )
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:etext)
              op: Equal
              rhs: {(DQ (' Ctrl-C to end.'))}
            )
          ]
        )
      ]
    )
    (C {(echo)} 
      {
        (DQ ('Tracing block I/O. Output every ') ($ VSub_DollarName '$interval') (' seconds.') 
          ($ VSub_DollarName '$etext')
        )
      }
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:offset)
          op: Equal
          rhs: 
            {
              (command_sub
                left_token: <Left_DollarParen '$('>
                command_list: 
                  (command.CommandList
                    children: [
                      (C {($ VSub_DollarName '$awk')} 
                        {
                          (SQ <'BEGIN { o = 0; }\n'> 
                            <'\t$1 == "#" && $2 ~ /TASK/ && NF == 6 { o = 1; }\n'> <'\t$2 ~ /TASK/ { print o; exit }'>
                          )
                        } {(trace)}
                      )
                    ]
                  )
              )
            }
        )
      ]
    )
    (C {(warn)} {(DQ ('echo > trace'))})
    (command.ShAssignment pairs:[(assign_pair lhs:(sh_lhs_expr.Name name:i) op:Equal rhs:{(0)})])
    (command.Pipeline
      children: [
        (command.WhileUntil
          keyword: <KW_While while>
          cond: [
            (command.Sentence
              child: 
                (command.DParen
                  child: 
                    (arith_expr.Binary
                      op_id: Arith_DPipe
                      left: 
                        (arith_expr.Unary
                          op_id: Arith_Bang
                          child: (arith_expr.VarRef token:<Lit_ArithVarLike opt_count>)
                        )
                      right: 
                        (arith_expr.Binary
                          op_id: Arith_Less
                          left: (arith_expr.VarRef token:<Lit_ArithVarLike i>)
                          right: (arith_expr.VarRef token:<Lit_ArithVarLike count>)
                        )
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          body: 
            (command.DoGroup
              children: [
                (command.DParen
                  child: (arith_expr.UnaryAssign op_id:Node_PostDPlus child:(sh_lhs_expr.Name name:i))
                )
                (C {(sleep)} {($ VSub_DollarName '$interval')})
                (command.If
                  arms: [
                    (if_arm
                      cond: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: (bool_expr.Unary op_id:BoolUnary_x child:{(snapshot)})
                            )
                          terminator: <Op_Semi ';'>
                        )
                      ]
                      action: [
                        (command.Simple
                          words: [{(echo)} {(1)}]
                          redirects: [
                            (redir.Redir
                              op: <Redir_Great '>'>
                              fd: 16777215
                              arg_word: {(snapshot)}
                            )
                          ]
                        )
                        (command.Simple
                          words: [{(echo)}]
                          redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(trace)})]
                        )
                        (C {(cat)} {(snapshot)})
                      ]
                    )
                  ]
                  else_action: [
                    (C {(cat)} {(trace)})
                    (command.Simple
                      words: [{(echo)}]
                      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(trace)})]
                    )
                  ]
                )
                (command.AndOr
                  ops: [Op_DAmp]
                  children: [
                    (command.DParen
                      child: (arith_expr.VarRef token:<Lit_ArithVarLike opt_timestamp>)
                    )
                    (C {(printf)} {(DQ ('time %(%H:%M:%S)T:') (Lit_Other '\\') (n))} {(-1)})
                  ]
                )
                (C {(echo)} {(DQ (tick))})
              ]
            )
        )
        (C {($ VSub_DollarName '$awk')} {(-v)} {(Lit_VarLike 'o=') ($ VSub_DollarName '$offset')} {(-v)} 
          {(Lit_VarLike 'opt_timestamp=') ($ VSub_DollarName '$opt_timestamp')} {(-v)} {(Lit_VarLike 'b_start=') ($ VSub_DollarName '$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: F
    )
    (C {(end)})
  ]
)