(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tracing)
          op: assign_op.Equal
          rhs: {<'/sys/kernel/debug/tracing'>}
          spids: [124]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:flock)
          op: assign_op.Equal
          rhs: {<'/var/tmp/.ftrace-lock'>}
          spids: [127]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:bufsize_kb)
          op: assign_op.Equal
          rhs: {<4096>}
          spids: [130]
        )
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:opt_device)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [133]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:device)
                  op: assign_op.Equal
                  rhs: (word.Empty)
                  spids: [137]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:opt_iotype)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [140]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:iotype)
                  op: assign_op.Equal
                  rhs: (word.Empty)
                  spids: [144]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:opt_timestamp)
              op: assign_op.Equal
              rhs: {<0>}
              spids: [147]
            )
          ]
        )
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:opt_interval)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [150]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:interval)
                  op: assign_op.Equal
                  rhs: {<1>}
                  spids: [154]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:opt_count)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [158]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:count)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [162]
                )
              ]
            )
          terminator: <Id.Op_Semi _>
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:opt_queue)
              op: assign_op.Equal
              rhs: {<0>}
              spids: [166]
            )
          ]
        )
      ]
    )
    (C {<trap>} {(SQ <':'>)} {<INT>} {<QUIT>} {<TERM>} {<PIPE>} {<HUP>})
    (command.ShFunction
      name: usage
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<cat>}]
              redirects: [
                (redir
                  op: <Id.Redir_DLessDash '<<-'>
                  loc: (redir_loc.Fd fd:0)
                  arg: 
                    (redir_param.MultiLine
                      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, '>
                        <Id.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 op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})
              ]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit>)
          ]
        )
    )
    (command.ShFunction
      name: warn
      body: 
        (BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [(C {<eval>} {(DQ ($ Id.VSub_At '$@'))})]
                          negated: T
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (command.Simple
                      words: [
                        {<echo>}
                        {
                          (DQ <'WARNING: command failed '> 
                            (word_part.EscapedLiteral
                              token: <Id.Lit_EscapedChar '\\"'>
                            ) ($ Id.VSub_At '$@') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>)
                          )
                        }
                      ]
                      redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                      do_fork: T
                    )
                  ]
                  spids: [237 248]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: end
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<echo>}]
              redirects: [(redir op:<Id.Redir_Great '2>'> loc:(redir_loc.Fd fd:2) arg:{<'/dev/null'>})]
              do_fork: T
            )
            (command.Simple
              words: [{<echo>} {(DQ <'Ending tracing...'>)}]
              redirects: [(redir op:<Id.Redir_Great '2>'> loc:(redir_loc.Fd fd:2) arg:{<'/dev/null'>})]
              do_fork: T
            )
            (C {<cd>} {($ Id.VSub_DollarName '$tracing')})
            (C {<warn>} {(DQ <'echo 0 > events/block/'> ($ Id.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: Id.Arith_DPipe
                              left: <Id.Lit_ArithVarLike opt_device>
                              right: <Id.Lit_ArithVarLike opt_iotype>
                            )
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (C {<warn>} 
                      {(DQ <'echo 0 > events/block/'> ($ Id.VSub_DollarName '$b_start') <'/filter'>)}
                    )
                    (C {<warn>} {(DQ <'echo 0 > events/block/block_rq_complete/filter'>)})
                  ]
                  spids: [317 331]
                )
              ]
            )
            (C {<warn>} {(DQ <'echo > trace'>)})
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.DParen child:<Id.Lit_ArithVarLike wroteflock>)
                (C {<warn>} {(DQ <'rm '> ($ Id.VSub_DollarName '$flock'))})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: die
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<echo>} {(DQ ($ Id.VSub_At '$@'))}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
        )
    )
    (command.ShFunction
      name: edie
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<echo>} {(DQ ($ Id.VSub_At '$@'))}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [{<exec>}]
              redirects: [
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {<'/dev/null'>}
                )
                (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
              ]
              do_fork: T
            )
            (C {<end>})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
        )
    )
    (command.WhileUntil
      keyword: <Id.KW_While while>
      cond: [(C {<getopts>} {<d> <Id.Lit_Colon ':'> <hi> <Id.Lit_Colon ':'> <QT>} {<opt>})]
      body: 
        (command.DoGroup
          children: [
            (command.Case
              to_match: {($ Id.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: assign_op.Equal
                              rhs: {<1>}
                              spids: [471]
                            )
                          ]
                        )
                      terminator: <Id.Op_Semi _>
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:device)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_DollarName '$OPTARG')}
                          spids: [475]
                        )
                      ]
                    )
                  ]
                  spids: [468 469 478 -1]
                )
                (case_arm
                  pat_list: [{<i>}]
                  action: [
                    (command.Sentence
                      child: 
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:opt_iotype)
                              op: assign_op.Equal
                              rhs: {<1>}
                              spids: [484]
                            )
                          ]
                        )
                      terminator: <Id.Op_Semi _>
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:iotype)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_DollarName '$OPTARG')}
                          spids: [488]
                        )
                      ]
                    )
                  ]
                  spids: [481 482 491 -1]
                )
                (case_arm
                  pat_list: [{<Q>}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:opt_queue)
                          op: assign_op.Equal
                          rhs: {<1>}
                          spids: [497]
                        )
                      ]
                    )
                  ]
                  spids: [494 495 500 -1]
                )
                (case_arm
                  pat_list: [{<T>}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:opt_timestamp)
                          op: assign_op.Equal
                          rhs: {<1>}
                          spids: [506]
                        )
                      ]
                    )
                  ]
                  spids: [503 504 509 -1]
                )
                (case_arm
                  pat_list: [{<h>} {<Id.Lit_QMark '?'>}]
                  action: [(C {<usage>})]
                  spids: [512 515 519 -1]
                )
              ]
            )
          ]
        )
    )
    (C {<shift>} 
      {
        (word_part.ArithSub
          anode: 
            (arith_expr.Binary
              op_id: Id.Arith_Minus
              left: {($ Id.VSub_DollarName '$OPTIND')}
              right: {<Id.Lit_Digits 1>}
            )
        )
      }
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:{($ Id.VSub_Pound '$#')})
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:opt_interval)
                  op: assign_op.Equal
                  rhs: {<1>}
                  spids: [552]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:interval)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [556]
                )
              ]
            )
            (C {<shift>})
          ]
          spids: [539 549]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:{($ Id.VSub_Pound '$#')})
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:opt_count)
                  op: assign_op.Equal
                  rhs: {<1>}
                  spids: [577]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:count)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [581]
                )
              ]
            )
          ]
          spids: [564 574]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:<Id.Lit_ArithVarLike opt_device>)
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:major)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <Id.VSub_Name device>
                        suffix_op: (suffix_op.Unary op_id:Id.VOp1_Percent arg_word:{<',*'>})
                      )
                    }
                  spids: [599]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:minor)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <Id.VSub_Name device>
                        suffix_op: (suffix_op.Unary op_id:Id.VOp1_Pound arg_word:{<'*,'>})
                      )
                    }
                  spids: [607]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:dev)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (word_part.ArithSub
                        anode: 
                          (arith_expr.Binary
                            op_id: Id.Arith_Plus
                            left: 
                              (arith_expr.Binary
                                op_id: Id.Arith_DLess
                                left: <Id.Lit_ArithVarLike major>
                                right: {<Id.Lit_Digits 20>}
                              )
                            right: <Id.Lit_ArithVarLike minor>
                          )
                      )
                    }
                  spids: [615]
                )
              ]
            )
          ]
          spids: [586 596]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:<Id.Lit_ArithVarLike opt_queue>)
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:b_start)
                  op: assign_op.Equal
                  rhs: {<block_rq_insert>}
                  spids: [648]
                )
              ]
            )
          ]
          spids: [635 645]
        )
      ]
      else_action: [
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:b_start)
              op: assign_op.Equal
              rhs: {<block_rq_issue>}
              spids: [654]
            )
          ]
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DAmp Id.Op_DPipe]
      children: [
        (command.DBracket expr:(bool_expr.Unary op_id:Id.BoolUnary_x child:{<'/usr/bin/mawk'>}))
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:awk)
              op: assign_op.Equal
              rhs: {(SQ <'mawk -W interactive'>)}
              spids: [673]
            )
          ]
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:awk)
              op: assign_op.Equal
              rhs: {<awk>}
              spids: [680]
            )
          ]
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<cd>} {($ Id.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: [Id.Op_DAmp]
      children: [
        (command.DBracket
          expr: (bool_expr.Unary op_id:Id.BoolUnary_e child:{($ Id.VSub_DollarName '$flock')})
        )
        (C {<die>} 
          {
            (DQ <'ERROR: ftrace may be in use by PID '> 
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                child: (C {<cat>} {($ Id.VSub_DollarName '$flock')})
              ) <' '> ($ Id.VSub_DollarName '$flock')
            )
          }
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (command.Simple
          words: [{<echo>} {($ Id.VSub_Dollar '$$')}]
          redirects: [
            (redir
              op: <Id.Redir_Great '>'>
              loc: (redir_loc.Fd fd:1)
              arg: {($ Id.VSub_DollarName '$flock')}
            )
          ]
          do_fork: T
        )
        (C {<die>} {(DQ <'ERROR: unable to write '> ($ Id.VSub_DollarName '$flock') <.>)})
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:wroteflock)
          op: assign_op.Equal
          rhs: {<1>}
          spids: [745]
        )
      ]
    )
    (C {<warn>} {(DQ <'echo nop > current_tracer'>)})
    (C {<warn>} {(DQ <'echo '> ($ Id.VSub_DollarName '$bufsize_kb') <' > buffer_size_kb'>)})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:filter)
          op: assign_op.Equal
          rhs: (word.Empty)
          spids: [766]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:<Id.Lit_ArithVarLike opt_iotype>)
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filter)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ <'rwbs ~ '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) 
                        ($ Id.VSub_DollarName '$iotype') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>)
                      )
                    }
                  spids: [781]
                )
              ]
            )
          ]
          spids: [768 778]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (command.DParen child:<Id.Lit_ArithVarLike opt_device>)
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (command.DBracket
                  expr: 
                    (bool_expr.Binary
                      op_id: Id.BoolBinary_GlobNEqual
                      left: {(DQ ($ Id.VSub_DollarName '$filter'))}
                      right: {(DQ )}
                    )
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:filter)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_DollarName '$filter') <' && '>)}
                      spids: [819]
                    )
                  ]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:filter)
                  op: assign_op.Equal
                  rhs: {(DQ (${ Id.VSub_Name filter) <'dev == '> ($ Id.VSub_DollarName '$dev'))}
                  spids: [826]
                )
              ]
            )
          ]
          spids: [791 801]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.DParen
                  child: 
                    (arith_expr.Binary
                      op_id: Id.Arith_DPipe
                      left: <Id.Lit_ArithVarLike opt_iotype>
                      right: <Id.Lit_ArithVarLike opt_device>
                    )
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.AndOr
                      ops: [Id.Op_DPipe]
                      children: [
                        (command.Pipeline
                          children: [
                            (command.Simple
                              words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$filter'))}]
                              redirects: [
                                (redir
                                  op: <Id.Redir_Great '>'>
                                  loc: (redir_loc.Fd fd:1)
                                  arg: 
                                    {<'events/block/'> ($ Id.VSub_DollarName '$b_start') <'/filter'>}
                                )
                              ]
                              do_fork: T
                            )
                          ]
                          negated: T
                        )
                        (command.Pipeline
                          children: [
                            (command.Simple
                              words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$filter'))}]
                              redirects: [
                                (redir
                                  op: <Id.Redir_Great '>'>
                                  loc: (redir_loc.Fd fd:1)
                                  arg: {<'events/block/block_rq_complete/filter'>}
                                )
                              ]
                              do_fork: T
                            )
                          ]
                          negated: T
                        )
                      ]
                    )
                  ]
                  action: [(C {<edie>} {(DQ <'ERROR: setting -d or -t filter. Exiting.'>)})]
                  spids: [854 887]
                )
              ]
            )
          ]
          spids: [837 851]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (command.AndOr
                  ops: [Id.Op_DPipe]
                  children: [
                    (command.Pipeline
                      children: [
                        (command.Simple
                          words: [{<echo>} {<1>}]
                          redirects: [
                            (redir
                              op: <Id.Redir_Great '>'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {<'events/block/'> ($ Id.VSub_DollarName '$b_start') <'/enable'>}
                            )
                          ]
                          do_fork: T
                        )
                      ]
                      negated: T
                    )
                    (command.Pipeline
                      children: [
                        (command.Simple
                          words: [{<echo>} {<1>}]
                          redirects: [
                            (redir
                              op: <Id.Redir_Great '>'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {<'events/block/block_rq_complete/enable'>}
                            )
                          ]
                          do_fork: T
                        )
                      ]
                      negated: T
                    )
                  ]
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          action: [(C {<edie>} {(DQ <'ERROR: enabling block I/O tracepoints. Exiting.'>)})]
          spids: [901 930]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:etext)
          op: assign_op.Equal
          rhs: (word.Empty)
          spids: [941]
        )
      ]
    )
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (command.DParen
          child: (arith_expr.Unary op_id:Id.Arith_Bang child:<Id.Lit_ArithVarLike opt_count>)
        )
        (command.ShAssignment
          pairs: [
            (assign_pair
              lhs: (sh_lhs_expr.Name name:etext)
              op: assign_op.Equal
              rhs: {(DQ <' Ctrl-C to end.'>)}
              spids: [953]
            )
          ]
        )
      ]
    )
    (C {<echo>} 
      {
        (DQ <'Tracing block I/O. Output every '> ($ Id.VSub_DollarName '$interval') <' seconds.'> 
          ($ Id.VSub_DollarName '$etext')
        )
      }
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:offset)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                child: 
                  (C {($ Id.VSub_DollarName '$awk')} 
                    {
                      (SQ <'BEGIN { o = 0; }\n'> 
                        <'\t$1 == "#" && $2 ~ /TASK/ && NF == 6 { o = 1; }\n'> <'\t$2 ~ /TASK/ { print o; exit }'>
                      )
                    } {<trace>}
                  )
              )
            }
          spids: [989]
        )
      ]
    )
    (C {<warn>} {(DQ <'echo > trace'>)})
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:i) op:assign_op.Equal rhs:{<0>} spids:[1012])]
    )
    (command.Pipeline
      children: [
        (command.WhileUntil
          keyword: <Id.KW_While while>
          cond: [
            (command.Sentence
              child: 
                (command.DParen
                  child: 
                    (arith_expr.Binary
                      op_id: Id.Arith_DPipe
                      left: 
                        (arith_expr.Unary
                          op_id: Id.Arith_Bang
                          child: <Id.Lit_ArithVarLike opt_count>
                        )
                      right: 
                        (arith_expr.Binary
                          op_id: Id.Arith_Less
                          left: <Id.Lit_ArithVarLike i>
                          right: <Id.Lit_ArithVarLike count>
                        )
                    )
                )
              terminator: <Id.Op_Semi _>
            )
          ]
          body: 
            (command.DoGroup
              children: [
                (command.DParen
                  child: 
                    (arith_expr.UnaryAssign
                      op_id: Id.Node_PostDPlus
                      child: <Id.Lit_ArithVarLike i>
                    )
                )
                (C {<sleep>} {($ Id.VSub_DollarName '$interval')})
                (command.If
                  arms: [
                    (if_arm
                      cond: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: (bool_expr.Unary op_id:Id.BoolUnary_x child:{<snapshot>})
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                      action: [
                        (command.Simple
                          words: [{<echo>} {<1>}]
                          redirects: [
                            (redir
                              op: <Id.Redir_Great '>'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {<snapshot>}
                            )
                          ]
                          do_fork: T
                        )
                        (command.Simple
                          words: [{<echo>}]
                          redirects: [
                            (redir
                              op: <Id.Redir_Great '>'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {<trace>}
                            )
                          ]
                          do_fork: T
                        )
                        (C {<cat>} {<snapshot>})
                      ]
                      spids: [1058 1069]
                    )
                  ]
                  else_action: [
                    (C {<cat>} {<trace>})
                    (command.Simple
                      words: [{<echo>}]
                      redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<trace>})]
                      do_fork: T
                    )
                  ]
                )
                (command.AndOr
                  ops: [Id.Op_DAmp]
                  children: [
                    (command.DParen child:<Id.Lit_ArithVarLike opt_timestamp>)
                    (C {<printf>} {(DQ <'time %(%H:%M:%S)T:'> <Id.Lit_Other '\\'> <n>)} {<-1>})
                  ]
                )
                (C {<echo>} {(DQ <tick>)})
              ]
            )
        )
        (C {($ Id.VSub_DollarName '$awk')} {<-v>} 
          {<Id.Lit_VarLike 'o='> ($ Id.VSub_DollarName '$offset')} {<-v>} {<Id.Lit_VarLike 'opt_timestamp='> ($ Id.VSub_DollarName '$opt_timestamp')} {<-v>} 
          {<Id.Lit_VarLike 'b_start='> ($ Id.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>})
  ]
)