18 #include <sys/types.h> 23 #include <netinet/in.h> 70 for (i = 1; i < 32; i++)
74 sa.sa_flags = SA_SIGINFO;
90 sa.sa_sigaction = (
void *) SIG_IGN;
98 if (sigaction (i, &sa, 0) < 0)
107 char *chroot_path = 0;
110 f64 *vector_ratep, *rx_ratep, *sig_error_ratep;
114 struct passwd _pw, *pw;
115 struct group _grp, *grp;
125 if (
unformat (&input,
"chroot %s", &chroot_path_u8))
127 chroot_path = (
char *) chroot_path_u8;
129 else if (
unformat (&input,
"interval %d", &interval))
131 else if (
unformat (&input,
"uid %d", &uid))
133 else if (
unformat (&input,
"gid %d", &gid))
135 else if (
unformat (&input,
"uid %s", &s))
139 rv = getpwnam_r (s, &_pw, buf,
sizeof (buf), &pw);
142 fformat (stderr,
"cannot fetch username %s", s);
147 fformat (stderr,
"username %s does not exist", s);
153 else if (
unformat (&input,
"gid %s", &s))
157 rv = getgrnam_r (s, &_grp, buf,
sizeof (buf), &grp);
160 fformat (stderr,
"cannot fetch group %s", s);
165 fformat (stderr,
"group %s does not exist", s);
174 "usage: vpp_get_metrics [chroot <path>] [interval <nn>]\n");
198 "vpp_sig_error_rate");
206 if (vpp_pidp == 0 || vector_ratep == 0 || rx_ratep == 0
207 || sig_error_ratep == 0)
209 fformat (stdout,
"vpp not running\n");
222 fformat (stdout,
"vpp not running\n");
226 "%d: vpp_vector_rate=%.2f, vpp_input_rate=%f, vpp_sig_error_rate=%f\n",
227 *vpp_pidp, *vector_ratep, *rx_ratep, *sig_error_ratep);
void * svmdb_local_get_variable_reference(svmdb_client_t *client, svmdb_namespace_t namespace, char *var)
Optimized string handling code, including c11-compliant "safe C library" variants.
static void unix_signal_handler(int signum, siginfo_t *si, ucontext_t *uc)
Fixed length block allocator.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void svmdb_unmap(svmdb_client_t *client)
static void setup_signal_handlers(void)
int main(int argc, char **argv)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
Bitmaps built as vectors of machine words.
volatile int signal_received
#define clib_unix_warning(format, args...)
svmdb_client_t * svmdb_map(svmdb_map_args_t *dba)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".