18 #include <sys/types.h> 23 #include <netinet/in.h> 70 for (i = 1; i < 32; i++)
72 memset (&sa, 0,
sizeof (sa));
74 sa.sa_flags = SA_SIGINFO;
89 sa.sa_sigaction = (
void *) SIG_IGN;
97 if (sigaction (i, &sa, 0) < 0)
106 char *chroot_path = 0;
109 f64 *vector_ratep, *rx_ratep, *sig_error_ratep;
113 struct passwd _pw, *pw;
114 struct group _grp, *grp;
124 if (
unformat (&input,
"chroot %s", &chroot_path_u8))
126 chroot_path = (
char *) chroot_path_u8;
128 else if (
unformat (&input,
"interval %d", &interval))
130 else if (
unformat (&input,
"uid %d", &uid))
132 else if (
unformat (&input,
"gid %d", &gid))
134 else if (
unformat (&input,
"uid %s", &s))
138 rv = getpwnam_r (s, &_pw, buf,
sizeof (buf), &pw);
141 fformat (stderr,
"cannot fetch username %s", s);
146 fformat (stderr,
"username %s does not exist", s);
152 else if (
unformat (&input,
"gid %s", &s))
156 rv = getgrnam_r (s, &_grp, buf,
sizeof (buf), &grp);
159 fformat (stderr,
"cannot fetch group %s", s);
164 fformat (stderr,
"group %s does not exist", s);
173 "usage: vpp_get_metrics [chroot <path>] [interval <nn>]\n");
180 memset (ma, 0,
sizeof (*ma));
197 "vpp_sig_error_rate");
205 if (vpp_pidp == 0 || vector_ratep == 0 || rx_ratep == 0
206 || sig_error_ratep == 0)
208 fformat (stdout,
"vpp not running\n");
221 fformat (stdout,
"vpp not running\n");
225 "%d: vpp_vector_rate=%.2f, vpp_input_rate=%f, vpp_sig_error_rate=%f\n",
226 *vpp_pidp, *vector_ratep, *rx_ratep, *sig_error_ratep);
sll srl srl sll sra u16x4 i
void * svmdb_local_get_variable_reference(svmdb_client_t *client, svmdb_namespace_t namespace, char *var)
static void unix_signal_handler(int signum, siginfo_t *si, ucontext_t *uc)
Fixed length block allocator.
void svmdb_unmap(svmdb_client_t *client)
static void setup_signal_handlers(void)
int main(int argc, char **argv)
#define vec_free(V)
Free vector's memory (no header).
#define clib_unix_warning(format, args...)
Bitmaps built as vectors of machine words.
volatile int signal_received
svmdb_client_t * svmdb_map(svmdb_map_args_t *dba)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".