summaryrefslogtreecommitdiffstats
path: root/lib/qpnexus.h
diff options
context:
space:
mode:
authorChris Hall <chris.hall@highwayman.com>2011-09-02 00:53:59 +0100
committerChris Hall <chris.hall@highwayman.com>2011-09-02 00:53:59 +0100
commit3690074a486cfada568975e287d9cbb9e687501f (patch)
treef6394c1ab1ca8381e9a77acca84f03dc701d10b2 /lib/qpnexus.h
parent3f515315d5b17e432453eef67d7ac9e27bc39461 (diff)
downloadquagga-3690074a486cfada568975e287d9cbb9e687501f.tar.bz2
quagga-3690074a486cfada568975e287d9cbb9e687501f.tar.xz
Merging of euro_ix branch into pipework.
Bring in fixes for bgp dumping with pthreaded BGP Engine. Bring in new "show nexus xxx" command. Fix removal of '~' prompt.
Diffstat (limited to 'lib/qpnexus.h')
-rw-r--r--lib/qpnexus.h40
1 files changed, 36 insertions, 4 deletions
diff --git a/lib/qpnexus.h b/lib/qpnexus.h
index 38dcbebc..15125150 100644
--- a/lib/qpnexus.h
+++ b/lib/qpnexus.h
@@ -24,11 +24,9 @@
#include "misc.h"
#include <time.h>
-#include <unistd.h>
#include <errno.h>
#include <signal.h>
-#include "zassert.h"
#include "qpthreads.h"
#include "qtimers.h"
#include "mqueue.h"
@@ -67,11 +65,32 @@ struct qpn_hook_list
unsigned count ;
} ;
+typedef struct qpn_stats
+{
+ qtime_mono_t start_time ;
+ qtime_mono_t last_time ;
+ qtime_mono_t idle ;
+
+ ulong cycles ;
+ ulong signals ;
+ ulong foreg ;
+ ulong dispatch ;
+ ulong io_acts ;
+ ulong timers ;
+ ulong backg ;
+
+} qpn_stats_t ;
+
+typedef qpn_stats_t* qpn_stats ;
+
typedef struct qpn_nexus* qpn_nexus ;
struct qpn_nexus
{
- /* set true to terminate the thread (eventually) */
+ /* name of thread */
+ const char* name ;
+
+ /* set true to terminate the thread (eventually) */
bool terminate;
/* true if this is the main thread */
@@ -141,6 +160,16 @@ struct qpn_nexus
* and return. MUST return 0 iff there is no more work to do.
*/
struct qpn_hook_list background ;
+
+
+ /* statistics gathering
+ */
+ qpt_spin_t stats_slk[1] ;
+
+ qpn_stats_t raw ; /* belongs to thread */
+ qpn_stats_t stats ; /* set, under spin lock, once per cycle */
+ qpn_stats_t prev_stats ; /* set, under spin lock, each time stats
+ * are fetched. */
};
/*------------------------------------------------------------------------------
@@ -159,10 +188,13 @@ qpn_find_self(void)
* Functions
*/
extern void qpn_init(void) ;
-extern qpn_nexus qpn_init_new(qpn_nexus qpn, bool main_thread);
+extern qpn_nexus qpn_init_new(qpn_nexus qpn, bool main_thread,
+ const char* name) ;
extern void qpn_add_hook_function(qpn_hook_list list, void* hook) ;
extern void qpn_exec(qpn_nexus qpn);
extern void qpn_terminate(qpn_nexus qpn);
extern qpn_nexus qpn_reset(qpn_nexus qpn, free_keep_b free_structure);
+extern void qpn_get_stats(qpn_nexus qpn, qpn_stats curr, qpn_stats prev) ;
+
#endif /* _ZEBRA_QPNEXUS_H */