Пример #1
0
/* module_init */
int module_init(void) {
    /* Initialize variables */
    my_module_globals.compiler  = NULL;
    my_module_globals.source    = NULL;
    my_module_globals.help_only = PERFEXPERT_FALSE;

    /* Parse module options */
    if (PERFEXPERT_SUCCESS != parse_module_args(myself_module.argc,
        myself_module.argv)) {
        OUTPUT(("%s", _ERROR("parsing module arguments")));
        return PERFEXPERT_ERROR;
    }

    /* Enable extended interface */
    myself_module.set_compiler = &module_set_compiler;
    myself_module.set_source   = &module_set_source;
    myself_module.set_flag     = &module_set_flag;
    myself_module.set_library  = &module_set_library;
    myself_module.get_flag     = &module_get_flag;
    myself_module.get_library  = &module_get_library;

    OUTPUT_VERBOSE((5, "%s", _MAGENTA("initialized")));

    return PERFEXPERT_SUCCESS;
}
Пример #2
0
/* module_load */
int module_load(void) {
    /* Disable extended interface */
    myself_module.set_target = NULL;
    myself_module.set_env    = NULL;
    myself_module.unset_env  = NULL;
    myself_module.get_env    = NULL;

    OUTPUT_VERBOSE((5, "%s", _MAGENTA("loaded")));

    return PERFEXPERT_SUCCESS;
}
Пример #3
0
/* module_load */
int module_load(void) {
    /* Disable extended interface */
    myself_module.set_compiler = NULL;
    myself_module.set_source   = NULL;
    myself_module.set_flag     = NULL;
    myself_module.set_library  = NULL;
    myself_module.get_flag     = NULL;
    myself_module.get_library  = NULL;

    OUTPUT_VERBOSE((5, "%s", _MAGENTA("loaded")));

    return PERFEXPERT_SUCCESS;
}
Пример #4
0
/* module_init */
int module_init(void) {

    /* Module pre-requisites */
    perfexpert_module_requires("timb", "hpctoolkit", PERFEXPERT_MODULE_AFTER,
                               PERFEXPERT_MODULE_MEASUREMENTS);

    /* Initialize some variables */
    my_module_globals.maximum = DBL_MIN;
    my_module_globals.minimum = DBL_MAX;
    my_module_globals.threads = 0;

    OUTPUT_VERBOSE((5, "%s", _MAGENTA("initialized")));

    return PERFEXPERT_SUCCESS;
}
Пример #5
0
/* module_init */
int module_init(void) {
    int i = 0;

    /* Enable extended interface */
    myself_module.set_target = &module_set_target;
    myself_module.set_env    = &module_set_env;
    myself_module.unset_env  = &module_unset_env;
    myself_module.get_env    = &module_get_env;

    OUTPUT(("Parsing arguments"));
    if (PERFEXPERT_SUCCESS != parse_module_args(myself_module.argc,
        myself_module.argv)) {
        OUTPUT(("%s", _ERROR("parsing module arguments")));
        return PERFEXPERT_ERROR;
    } 

    OUTPUT_VERBOSE((1, "Make sure that your makefile does not overwrite CLAGS, CXXFLAGS, FCFLAGS (instead, it should append values to these variables"));

    OUTPUT_VERBOSE((5, "%s", _MAGENTA("initialized")));

    return PERFEXPERT_SUCCESS;
}
Пример #6
0
/* lcpi_parse_file */
int lcpi_parse_file(const char *file) {
    char buffer[BUFFER_SIZE];
    FILE *lcpi_FP = NULL;
    lcpi_t *lcpi = NULL;
    int line = 0;

    OUTPUT_VERBOSE((4, "%s", _BLUE("Loading LCPI metrics")));

    if (NULL == (lcpi_FP = fopen(file, "r"))) {
        OUTPUT(("%s (%s)", _ERROR("Error: unable to open LCPI file"), file));
        return PERFEXPERT_ERROR;
    }

    bzero(buffer, BUFFER_SIZE);
    while (NULL != fgets(buffer, BUFFER_SIZE - 1, lcpi_FP)) {
        char *token = NULL;

        line++;

        /* Ignore comments and blank lines */
        if ((0 == strncmp("#", buffer, 1)) ||
            (strspn(buffer, " \t\r\n") == strlen(buffer))) {
            continue;
        }

        /* Remove the end \n character */
        buffer[strlen(buffer) - 1] = '\0';

        /* Replace some characters just to provide a safe expression */
        perfexpert_string_replace_char(buffer, ':', '_');

        /* Allocate and set LCPI data */
        PERFEXPERT_ALLOC(lcpi_t, lcpi, sizeof(lcpi_t));
        lcpi->value = 0.0;

        token = strtok(buffer, "=");
        PERFEXPERT_ALLOC(char, lcpi->name, strlen(token) + 1);
        strcpy(lcpi->name, perfexpert_string_remove_char(token, ' '));
        strcpy(lcpi->name_md5, perfexpert_md5_string(lcpi->name));

        token = strtok(NULL, "=");
        lcpi->expression = evaluator_create(token);
        if (NULL == lcpi->expression) {
            OUTPUT(("%s (%s)", _ERROR("Error: invalid expression at line"),
                line));
            return PERFEXPERT_ERROR;
        }

        /* Add LCPI to global hash of LCPIs */
        perfexpert_hash_add_str(globals.lcpi_by_name, name_md5, lcpi);

        OUTPUT_VERBOSE((7, "   [%s]=[%s] (%s)", lcpi->name,
            evaluator_get_string(lcpi->expression), lcpi->name_md5));
    }

    OUTPUT_VERBOSE((4, "   (%d) %s",
        perfexpert_hash_count_str(globals.lcpi_by_name),
        _MAGENTA("LCPI metric(s) found")));

    return PERFEXPERT_SUCCESS;
}
Пример #7
0
/* module_fini */
int module_fini(void) {
    OUTPUT_VERBOSE((5, "%s", _MAGENTA("finalized")));

    return PERFEXPERT_SUCCESS;
}
Пример #8
0
/* module_load */
int module_load(void) {
    OUTPUT_VERBOSE((5, "%s", _MAGENTA("loaded")));

    return PERFEXPERT_SUCCESS;
}