示例#1
0
static void report_ftrace_filters(struct buffer_instance *instance)
{
	char *path;

	path = get_instance_file(instance, "set_ftrace_filter");
	if (!path)
		die("malloc");

	list_functions(path, "Function Filter");
	
	tracecmd_put_tracing_file(path);

	path = get_instance_file(instance, "set_ftrace_notrace");
	if (!path)
		die("malloc");

	list_functions(path, "Function No Trace");
	
	tracecmd_put_tracing_file(path);
}
示例#2
0
variant_type toolkit_class_base::get_value(std::string key, variant_map_type& arg) {
  perform_registration();
  if (key == "list_functions") {
    return to_variant(list_functions());
  } else if (key == "list_get_properties") {
    return to_variant(list_get_properties());
  } else if (key == "list_set_properties") {
    return to_variant(list_set_properties());
  } else if (key == "call_function") {
    // dispatches to a user defined function
    if (!arg.count("__function_name__")) {
      throw("Invalid function call format");
    }
    std::string function_name = variant_get_value<std::string>(arg["__function_name__"]);
    return to_variant(call_function(function_name, arg));
  } else if (key == "set_property") {
    // dispatches to a user defined set property
    if (!arg.count("__property_name__")) {
      throw("Invalid function call format");
    }
    std::string property_name = variant_get_value<std::string>(arg["__property_name__"]);
    return to_variant(set_property(property_name, arg));
  } else if (key == "get_property") {
    // dispatches to a user defined get property
    if (!arg.count("__property_name__")) {
      throw("Invalid function call format");
    }
    std::string property_name = variant_get_value<std::string>(arg["__property_name__"]);
    return to_variant(get_property(property_name, arg));
  } else if (key == "get_docstring") {
    // dispatches to a user defined get property
    if (!arg.count("__symbol__")) {
      throw("Invalid function call format");
    }
    std::string symbol = variant_get_value<std::string>(arg["__symbol__"]);
    return to_variant(get_docstring(symbol));
  } else if (key == "__name__") {
    return name();
  } else if (key == "__uid__") {
    return uid();
  } else {
    return variant_type();
  }
}
示例#3
0
int main(int argc, char ** argv)
{
    short israpl = 0;
    char next = '\0';
    ISVERBOSE = 0;
    init_msr();
    uint64_t msr_data;
    uint64_t msr;
    unsigned thread;
    int i;
    for (i = 0; i < argc; i++)
    {
        if (argv[i][0] == '-')
        {
            switch(argv[i][1])
            {
                case 'v':
                    // do verbose stuff
                    ISVERBOSE = 1;
                    break;
                case 'r':
                    // read an msr
                    if (argc - i < 3)
                    {
                        fprintf(stderr, "Error: not enough parameters to read flag\n");
                        generic_error(i, argv);
                    }
                    thread = atoi(argv[++i]);
                    msr = strtol(argv[++i], NULL, 16);
                    read_msr_by_idx(thread, msr, &msr_data);
                    fprintf(stdout, "%lx\n", msr_data);
                    break;
                case 'w':
                    // write an msr
                    if (argc - i < 4)
                    {
                        fprintf(stderr, "Error: not enough parameters to write flag\n");
                        generic_error(i, argv);
                    }
                    thread = atoi(argv[++i]);
                    msr = strtol(argv[++i], NULL, 16);
                    msr_data = strtol(argv[++i], NULL, 16);
                    write_msr_by_idx(thread, msr, msr_data);
                    break;
                case 'i':
                    // do interactive stuff
                    fprintf(stdout, "Interactive mode is not yet available\n");
                    break;
                case '-':
                    // go deeper down the rabbit hole
                    switch(argv[i][2])
                    {
                        case 'h':
                            // print help stuff
                            help_stuff();
                            break;
                    }
                    return 0;
                case 'p':
                    // print out stuff
                    printing_functions(&i, argc, argv);
                    break;
                case 's':
                    // set a socket limit or set to default
                    set_functions(&i, argc, argv);
                    break;
                case 'l':
                    // list available events
                    list_functions(&i, argc, argv);
                    
                    return 0;
            }
        }
    }
 //   if (israpl)
 //   {
//        do_rapl_stuff(isverbose);
 //   }
    return 0;
}