Пример #1
0
void setup_caliper_config(const Args& args)
{
    const char* progressmonitor_profile[][2] = {
        { "CALI_SERVICES_ENABLE", "event:report:textlog:trace:timestamp" },
        { "CALI_EVENT_TRIGGER",   "annotation:cali-query.stream"         },
        { "CALI_TEXTLOG_TRIGGER", "cali-query.stream" },

        { "CALI_TEXTLOG_FORMATSTRING",
          "cali-query: Processed %[52]cali-query.stream% (thread %[2]thread%): %[8]time.inclusive.duration% us" },

        { "CALI_REPORT_CONFIG",
          "SELECT annotation,time.inclusive.duration WHERE event.end#annotation FORMAT table" },

        { NULL, NULL }
    };
    
    cali_config_preset("CALI_LOG_VERBOSITY", "0");
    cali_config_preset("CALI_CALIPER_ATTRIBUTE_PROPERTIES", "annotation=process_scope:nested");

    cali_config_allow_read_env(false);

    cali_config_define_profile("caliquery-progressmonitor", progressmonitor_profile);

    cali_config_set("CALI_CONFIG_FILE", "cali-query_caliper.config");
    
    if (args.is_set("verbose"))
        cali_config_preset("CALI_LOG_VERBOSITY", "1");
    if (args.is_set("profile"))
        cali_config_set("CALI_CONFIG_PROFILE", "caliquery-progressmonitor");

    std::vector<std::string> config_list = 
        StringConverter(args.get("caliper-config")).to_stringlist();

    for (const std::string entry : config_list) {
        auto p = entry.find('=');

        if (p == std::string::npos) {
            std::cerr << "cali-query: error: invalid Caliper configuration flag format \"" 
                      << entry << "\" (missing \"=\")" << std::endl;
            continue;
        }

        cali_config_set(entry.substr(0, p).c_str(), entry.substr(p+1).c_str());
    }
}
    Parameter(Args& args)
        : tracker_param(args)
    {
        args.get("step_through",           step_through);
        args.get("default_sensor_bg",      default_sensor_bg);

        args.get("error_type",             error_type);
        args.get("error_start_iteration",  error_start_iteration);
        args.get("manual_error_pixels",    manual_error_pixels);
        args.get("manual_error_start",     manual_error_start);
        args.get("manual_error_magnitude", manual_error_magnitude);

        args.get("gt_color_r", gt_color_r);
        args.get("gt_color_g", gt_color_g);
        args.get("gt_color_b", gt_color_b);

        args.get("belief_color_r", belief_color_r);
        args.get("belief_color_g", belief_color_g);
        args.get("belief_color_b", belief_color_b);

        args.get("gt_color_r2", gt_color_r2);
        args.get("gt_color_g2", gt_color_g2);
        args.get("gt_color_b2", gt_color_b2);

        args.get("belief_color_r2", belief_color_r2);
        args.get("belief_color_g2", belief_color_g2);
        args.get("belief_color_b2", belief_color_b2);

        int downsampling;
        args.get("downsampling", downsampling);

        height = 480 / downsampling;
        width = 640 / downsampling;
    }