Lines Matching +full:1 +full:s

28  * __ikm_read_enable - reads monitor's enable status
32 * Returns the current status, or -1 if the monitor does not exist,
41 snprintf(path, MAX_PATH, "rv/monitors/%s/enable", monitor_name);
45 return -1;
55 * Returns 1 if we found the monitor, -1 on error and 0 if it does not exist.
67 return -1;
74 if (strcmp(line, monitor_name) && (!colon || strcmp(colon + 1, monitor_name)))
78 out_name[2 * MAX_DA_NAME_LEN - 1] = '\0';
86 config_is_container = 1;
89 found = 1;
98 * ikm_read_enable - reads monitor's enable status
100 * Returns the current status, or -1 on error.
109 return -1;
118 * ikm_write_enable - write to the monitor's enable file
120 * Return the number of bytes written, -1 on error.
127 debug_msg("ikm: writing enabled: %s\n", enable_disable);
129 snprintf(path, MAX_PATH, "rv/monitors/%s/enable", monitor_name);
132 err_msg("ikm: writing enabled: %s\n", enable_disable);
133 return -1;
142 * Returns -1 on failure. Success otherwise.
146 return ikm_write_enable(monitor_name, "1");
152 * Returns -1 on failure. Success otherwise.
162 * Return a dynamically allocated string with the monitor's
170 snprintf(path, MAX_PATH, "rv/monitors/%s/desc", monitor_name);
173 err_msg("ikm: error reading monitor %s desc\n", monitor_name);
183 * ikm_fill_monitor_definition - fill monitor's definition
185 * Returns -1 on error, 1 if the monitor does not belong in the container, 0 otherwise.
200 return 1;
204 ikm->nested = 1;
207 return 1;
214 err_msg("ikm: monitor %s fail to read enable file, bug?\n", name);
215 return -1;
220 err_msg("ikm: monitor %s does not have desc file, bug?\n", name);
221 return -1;
224 strncpy(ikm->name, nested_name, sizeof(ikm->name) - 1);
225 ikm->name[sizeof(ikm->name) - 1] = '\0';
227 strncpy(ikm->desc, desc, sizeof(ikm->desc) - 1);
228 ikm->desc[sizeof(ikm->desc) - 1] = '\0';
237 * Return the number or characters written, -1 on error.
244 snprintf(path, MAX_PATH, "rv/monitors/%s/reactors", monitor_name);
246 debug_msg("ikm: write \"%s\" reactors: %d\n", reactor, retval);
254 * Returns a dynamically allocated string with monitor's
262 snprintf(path, MAX_PATH, "rv/monitors/%s/reactors", monitor_name);
265 err_msg("ikm: fail reading monitor's %s reactors file\n", monitor_name);
303 curr_reactor = calloc(strlen(start) + 1, sizeof(char));
308 debug_msg("ikm: read current reactor %s\n", curr_reactor);
322 snprintf(path, MAX_PATH, "events/rv/event_%s/format", monitor_name);
325 err_msg("ikm: fail reading monitor's %s format event file\n", monitor_name);
326 return -1;
329 /* print fmt: "%d: %s x %s -> %s %s", REC->id, ... */
332 debug_msg("ikm: monitor %s has id: %s\n", monitor_name, has_id ? "yes" : "no");
342 * Returns 0 on success, -1 otherwise.
355 return -1;
370 list_monitor = 1;
371 printf("%s%-*s %s %s\n", indent ? " - " : "",
381 printf("-- No monitor found in container %s --\n", container);
391 static void ikm_print_header(struct trace_seq *s)
393 trace_seq_printf(s, "%16s-%-8s %5s %5s ", "<TASK>", "PID", "[CPU]", "TYPE");
395 trace_seq_printf(s, "%8s ", "ID");
397 trace_seq_printf(s, "%24s x %-24s -> %-24s %s\n",
403 trace_seq_printf(s, "%16s %-8s %5s %5s ", " | ", " | ", " | ", " | ");
406 trace_seq_printf(s, "%8s ", " | ");
408 trace_seq_printf(s, "%24s %-24s %-24s %s\n",
423 ikm_event_handler(struct trace_seq *s, struct tep_record *record,
435 missing_id = tep_get_field_val(s, trace_event, "id", record, &id, 1);
437 tep_get_common_field_val(s, trace_event, "common_pid", record, &pid, 1);
444 tep_print_event(trace_event->tep, s, record, "%16s-%-8d [%.3d] ",
448 tep_print_event(trace_event->tep, s, record, "%s ", TEP_PRINT_NAME);
450 trace_seq_printf(s, "event ");
455 trace_seq_printf(s, " ");
457 trace_seq_printf(s, "%8llu ", id);
460 state = tep_get_field_raw(s, trace_event, "state", record, &val, 0);
461 event = tep_get_field_raw(s, trace_event, "event", record, &val, 0);
462 next_state = tep_get_field_raw(s, trace_event, "next_state", record, &val, 0);
463 tep_get_field_val(s, trace_event, "final_state", record, &final_state, 1);
465 trace_seq_printf(s, "%24s x %-24s -> %-24s %s\n",
471 trace_seq_do_printf(s);
472 trace_seq_reset(s);
484 ikm_error_handler(struct trace_seq *s, struct tep_record *record,
494 missing_id = tep_get_field_val(s, trace_event, "id", record, &id, 1);
496 tep_get_common_field_val(s, trace_event, "common_pid", record, &pid, 1);
503 trace_seq_printf(s, "%8lld [%03d] ", pid, cpu);
506 tep_print_event(trace_event->tep, s, record, "%s ", TEP_PRINT_NAME);
508 trace_seq_printf(s, "error ");
513 trace_seq_printf(s, " ");
515 trace_seq_printf(s, "%8llu ", id);
518 state = tep_get_field_raw(s, trace_event, "state", record, &val, 0);
519 event = tep_get_field_raw(s, trace_event, "event", record, &val, 0);
521 trace_seq_printf(s, "%24s x %s\n", state, event);
523 trace_seq_do_printf(s);
524 trace_seq_reset(s);
534 snprintf(event, sizeof(event), "event_%s", monitor_name);
537 return -1;
539 tep_register_event_handler(inst->tep, -1, "rv", event,
542 snprintf(event, sizeof(event), "error_%s", monitor_name);
545 return -1;
547 tep_register_event_handler(inst->tep, -1, "rv", event,
550 /* set if at least 1 monitor has id in case of a container */
553 return -1;
567 snprintf(rv_path, MAX_PATH, "rv/monitors/%s", monitor_name);
570 return -1;
603 inst = calloc(1, sizeof(*inst));
664 fprintf(stderr, " %s", start);
686 " -s/--self: when tracing (-t), also trace rv command",
687 " -t/--trace: trace monitor's event",
697 fprintf(stderr, " %s\n", message);
699 fprintf(stderr, "\n usage: rv mon %s [-h] [-q] [-r reactor] [-s] [-v]", monitor_name);
702 fprintf(stderr, "%s\n", usage[i]);
717 while (1) {
721 {"self", no_argument, 0, 's'},
733 if (c == -1)
743 case 's':
744 config_my_pid = -1;
747 config_trace = 1;
750 config_debug = 1;
758 ikm_usage(1, monitor_name,
763 ikm_usage(1, monitor_name,
764 "ikm: failed to set %s reactor, is it available?",
776 * Returns 1 if a monitor was found an executed, 0 if no
777 * monitors were found, or -1 on error.
795 err_msg("ikm: error finding monitor %s\n", nested_name);
796 return -1;
801 err_msg("ikm: monitor %s (in-kernel) is already enabled\n", nested_name);
802 return -1;
808 ikm_usage(1, nested_name, "ikm: failed parsing arguments");
837 sleep(1);
846 return 1;
852 return -1;