Changeset 58a84d386885a444866925f495594b50f1bc4623

Show
Ignore:
Timestamp:
02/18/11 16:51:16 (4 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
  • src/noit_console_state.c

    r5491270 r58a84d3  
    3434 
    3535#include "eventer/eventer.h" 
     36#include "eventer/eventer_jobq.h" 
    3637#include "utils/noit_log.h" 
    3738#include "utils/noit_hash.h" 
     
    8081            cname ? cname : funcptr, e->closure); 
    8182} 
     83static void 
     84noit_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} 
    8295static int 
    8396noit_console_eventer_timers(noit_console_closure_t ncct, int argc, char **argv, 
     
    92105  if(argc != 0) return -1; 
    93106  eventer_foreach_fdevent(noit_console_spit_event, ncct); 
     107  return 0; 
     108} 
     109static int 
     110noit_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); 
    94120  return 0; 
    95121} 
     
    112138cmd_info_t console_command_eventer_sockets = { 
    113139  "sockets", noit_console_eventer_sockets, NULL, NULL, NULL 
     140}; 
     141cmd_info_t console_command_eventer_jobq = { 
     142  "jobq", noit_console_eventer_jobq, NULL, NULL, NULL 
    114143}; 
    115144 
     
    484513    noit_console_state_add_cmd(evdeb, &console_command_eventer_timers); 
    485514    noit_console_state_add_cmd(evdeb, &console_command_eventer_sockets); 
     515    noit_console_state_add_cmd(evdeb, &console_command_eventer_jobq); 
    486516  } 
    487517  return _top_level_state;