Permalink
Browse files

A .gdbinit file with show_fair_peers command

  • Loading branch information...
1 parent 84622e0 commit 04b210b4eb64bc41aa24fec1cbfd0897aae17a95 @gnosek committed Jun 14, 2008
Showing with 39 additions and 0 deletions.
  1. +39 −0 .gdbinit
View
@@ -0,0 +1,39 @@
+define show_fair_peer
+ set $n = (ngx_http_upstream_fair_shm_block_t *)$arg0
+ set $peers = $n->peers
+ set $rr_peers = $peers->rrp
+ printf "upstream id: 0x%08x, current peer: %d/%d\n", $n->node.key, $peers->current, $rr_peers->number
+ set $i = 0
+ while $i < $rr_peers->number
+ printf "peer %d: %s weight: %d/%d fails: %d/%d acc: %d down: %d nreq: %u last_act: %u\n", $i, $rr_peers->peer[$i].name.data,\
+ $rr_peers->peer[$i].current_weight, $rr_peers->peer[$i].weight,\
+ $rr_peers->peer[$i].fails, $rr_peers->peer[$i].max_fails,\
+ $rr_peers->peer[$i].accessed, $rr_peers->peer[$i].down,\
+ $n->stats[$i].nreq, $n->stats[$i].last_active
+ set $i = $i + 1
+ end
+ printf "-----------------\n"
+ if ($n->node.left != $arg1)
+ show_fair_peer $n->node.left $arg1
+ end
+ if ($n->node.right != $arg1)
+ show_fair_peer $n->node.right $arg1
+ end
+end
+
+define show_fair_peers
+ set $tree = ngx_http_upstream_fair_rbtree
+ if (!$tree)
+ printf "Cannot find the upstream_fair peer information tree\n"
+ else
+ set $root = (ngx_http_upstream_fair_shm_block_t *)($tree->root)
+ if ($root != $tree->sentinel)
+ show_fair_peer $root $tree->sentinel
+ else
+ printf "No upstream_fair peer information\n"
+ end
+ end
+end
+document show_fair_peers
+Dump upstream_fair peer infromation
+end

0 comments on commit 04b210b

Please sign in to comment.