Пример #1
0
extern void Offload_Report_Prolog(OffloadHostTimerData *pnode)
{
    double frequency = cpu_frequency;
    std::string       buf;
    std::stringstream ss;

    if (pnode) {
        // [Offload] [Mic 0] [File]          file.c
        ss << "[" << report_get_message_str(c_report_offload) << "] [";
        ss << report_get_message_str(c_report_mic) << " ";
        ss << pnode->card_number << "] [";
        ss << report_get_message_str(c_report_file);
        ss << "]                    " << pnode->file << "\n";

        // [Offload] [Mic 0] [Line]          1234
        ss << "[" << report_get_message_str(c_report_offload) << "] [";
        ss << report_get_message_str(c_report_mic) << " ";
        ss << pnode->card_number << "] [";
        ss << report_get_message_str(c_report_line);
        ss << "]                    " << pnode->line << "\n";

        // [Offload] [Mic 0] [Tag]          Tag 1
        ss << "[" << report_get_message_str(c_report_offload) << "] [";
        ss << report_get_message_str(c_report_mic) << " ";
        ss << pnode->card_number << "] [";
        ss << report_get_message_str(c_report_tag);
        ss << "]                     " << report_get_message_str(c_report_tag);
        ss << " " << pnode->offload_number << "\n";

        buf = ss.str();
        fprintf(stdout, buf.data());
        fflush(stdout);
    }
}
Пример #2
0
extern void Offload_Timer_Print(void)
{
    std::string       buf;
    std::stringstream ss;
    const char *stars =
        "**************************************************************";

    ss << "\n\n" << stars << "\n";
    ss << "                             ";
    ss << report_get_message_str(c_report_title) << "\n";
    ss << stars << "\n";
    double frequency = cpu_frequency;

    for (OffloadHostTimerData *pnode = timer_data_head;
         pnode != 0; pnode = pnode->next) {
        ss << "      ";
        ss << report_get_message_str(c_report_from_file) << " "<< pnode->file;
        ss << report_get_message_str(c_report_line) << " " << pnode->line;
        ss << "\n";
        for (int i = 0; i < c_offload_host_max_phase ; i++) {
            ss << "          ";
            offload_host_phase_name(ss, i);
            ss << "   " << std::fixed << std::setprecision(5);
            ss << (double)pnode->phases[i].total / frequency << "\n";
        }

        for (int i = 0; i < c_offload_target_max_phase ; i++) {
            double time = 0;
            if (pnode->target.frequency != 0) {
                time = (double) pnode->target.phases[i].total /
                       (double) pnode->target.frequency;
            }
            ss << "          ";
            offload_target_phase_name(ss, i);
            ss << "   " << std::fixed << std::setprecision(5);
            ss << time << "\n";
        }
    }

    buf = ss.str();
    fprintf(stdout, buf.data());
    fflush(stdout);
}
Пример #3
0
void __offload_target_init(void)
{
#ifdef SEP_SUPPORT
    const char* env_var = getenv(sep_monitor_env);
    if (env_var != 0 && *env_var != '\0') {
        sep_monitor = atoi(env_var);
    }
    env_var = getenv(sep_device_env);
    if (env_var != 0 && *env_var != '\0') {
        sep_device = env_var;
    }
#endif // SEP_SUPPORT

    prefix = report_get_message_str(c_report_mic);

    // init frequency
    mic_frequency = COIPerfGetCycleFrequency();
}
Пример #4
0
extern void Offload_Report_Epilog(OffloadHostTimerData * timer_data)
{
    double frequency = cpu_frequency;
    std::string       buf;
    std::stringstream ss;

    OffloadHostTimerData *pnode = timer_data;

    if (!pnode) {
        return;
    }
    ss << "[" << report_get_message_str(c_report_offload) << "] [";
    ss << report_get_message_str(c_report_host) << "]  [";
    ss << report_get_message_str(c_report_tag) <<  " ";
    ss << pnode->offload_number << "] [";
    ss << report_get_message_str(c_report_cpu_time) << "]        ";
    ss << std::fixed << std::setprecision(6);
    ss << (double) pnode->phases[0].total / frequency;
    ss << report_get_message_str(c_report_seconds) << "\n";

    if (offload_report_level >= OFFLOAD_REPORT_2) {
        ss << "[" << report_get_message_str(c_report_offload) << "] [";
        ss << report_get_message_str(c_report_mic);
        ss << " " << pnode->card_number;
        ss << "] [" << report_get_message_str(c_report_tag) << " ";
        ss <<  pnode->offload_number << "] [";
        ss << report_get_message_str(c_report_cpu_to_mic_data) << "]   ";
        ss << pnode->sent_bytes << " ";
        ss << report_get_message_str(c_report_bytes) << "\n";
    }

    double time = 0;
    if (pnode->target.frequency != 0) {
        time = (double) pnode->target.phases[0].total /
            (double) pnode->target.frequency;
    }
    ss << "[" << report_get_message_str(c_report_offload) << "] [";
    ss << report_get_message_str(c_report_mic) << " ";
    ss << pnode->card_number<< "] [";
    ss << report_get_message_str(c_report_tag) <<  " ";
    ss << pnode->offload_number << "] [";
    ss << report_get_message_str(c_report_mic_time) << "]        ";
    ss << std::fixed << std::setprecision(6) << time;
    ss << report_get_message_str(c_report_seconds) << "\n";

    if (offload_report_level >= OFFLOAD_REPORT_2) {
        ss << "[" << report_get_message_str(c_report_offload) << "] [";
        ss << report_get_message_str(c_report_mic);
        ss << " " << pnode->card_number;
        ss << "] [" << report_get_message_str(c_report_tag) << " ";
        ss <<  pnode->offload_number << "] [";
        ss << report_get_message_str(c_report_mic_to_cpu_data) << "]   ";
        ss << pnode->received_bytes << " ";
        ss << report_get_message_str(c_report_bytes) << "\n";
    }
    ss << "\n";

    buf = ss.str();
    fprintf(stdout, buf.data());
    fflush(stdout);

    offload_report_free_data(timer_data);
}