Changeset 58a84d386885a444866925f495594b50f1bc4623
- Timestamp:
- 02/18/11 16:51:16
(2 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1298047876 +0000
- git-parent:
[4a4fa329f7b3b7b3d8927d10092ec0ec3a8c7770]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1298047876 +0000
- Message:
expose jobq info
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r5491270 |
r58a84d3 |
|
| 34 | 34 | |
|---|
| 35 | 35 | #include "eventer/eventer.h" |
|---|
| | 36 | #include "eventer/eventer_jobq.h" |
|---|
| 36 | 37 | #include "utils/noit_log.h" |
|---|
| 37 | 38 | #include "utils/noit_hash.h" |
|---|
| … | … | |
| 80 | 81 | cname ? cname : funcptr, e->closure); |
|---|
| 81 | 82 | } |
|---|
| | 83 | static void |
|---|
| | 84 | noit_console_spit_jobq(eventer_jobq_t *jobq, void *c) { |
|---|
| | 85 | noit_console_closure_t ncct = c; |
|---|
| | 86 | int qlen = 0; |
|---|
| | 87 | const char *bqn = "(undefined)"; |
|---|
| | 88 | if(jobq->backq && jobq->backq->queue_name) bqn = jobq->backq->queue_name; |
|---|
| | 89 | nc_printf(ncct, "=== %s ===\n", jobq->queue_name); |
|---|
| | 90 | nc_printf(ncct, " concurrency: %d\n", jobq->concurrency); |
|---|
| | 91 | nc_printf(ncct, " backq: %s\n", bqn); |
|---|
| | 92 | sem_getvalue(&jobq->semaphore, &qlen); |
|---|
| | 93 | nc_printf(ncct, " queue size: %d\n", qlen); |
|---|
| | 94 | } |
|---|
| 82 | 95 | static int |
|---|
| 83 | 96 | noit_console_eventer_timers(noit_console_closure_t ncct, int argc, char **argv, |
|---|
| … | … | |
| 92 | 105 | if(argc != 0) return -1; |
|---|
| 93 | 106 | eventer_foreach_fdevent(noit_console_spit_event, ncct); |
|---|
| | 107 | return 0; |
|---|
| | 108 | } |
|---|
| | 109 | static int |
|---|
| | 110 | noit_console_eventer_jobq(noit_console_closure_t ncct, int argc, char **argv, |
|---|
| | 111 | noit_console_state_t *dstate, void *unused) { |
|---|
| | 112 | eventer_jobq_t *jobq; |
|---|
| | 113 | if(argc != 1) return -1; |
|---|
| | 114 | jobq = eventer_jobq_retrieve(argv[0]); |
|---|
| | 115 | if(!jobq) { |
|---|
| | 116 | nc_printf(ncct, "no jobq found for '%s'\n", argv[0] ? argv[0] : ""); |
|---|
| | 117 | return 0; |
|---|
| | 118 | } |
|---|
| | 119 | noit_console_spit_jobq(jobq, ncct); |
|---|
| 94 | 120 | return 0; |
|---|
| 95 | 121 | } |
|---|
| … | … | |
| 112 | 138 | cmd_info_t console_command_eventer_sockets = { |
|---|
| 113 | 139 | "sockets", noit_console_eventer_sockets, NULL, NULL, NULL |
|---|
| | 140 | }; |
|---|
| | 141 | cmd_info_t console_command_eventer_jobq = { |
|---|
| | 142 | "jobq", noit_console_eventer_jobq, NULL, NULL, NULL |
|---|
| 114 | 143 | }; |
|---|
| 115 | 144 | |
|---|
| … | … | |
| 484 | 513 | noit_console_state_add_cmd(evdeb, &console_command_eventer_timers); |
|---|
| 485 | 514 | noit_console_state_add_cmd(evdeb, &console_command_eventer_sockets); |
|---|
| | 515 | noit_console_state_add_cmd(evdeb, &console_command_eventer_jobq); |
|---|
| 486 | 516 | } |
|---|
| 487 | 517 | return _top_level_state; |
|---|