void leave_block(const std::string &msg, const bool indent)
{
    if (inhibit_profiling_counters)
    {
        return;
    }

#ifndef MULTICORE
    assert(*(--block_names.end()) == msg);
#endif
    block_names.pop_back();

    ++invocation_counts[msg];

    long long t = get_nsec_time();
    last_times[msg] = (t - enter_times[msg]);
    cumulative_times[msg] += (t - enter_times[msg]);

    long long cpu_t = get_nsec_cpu_time();
    last_cpu_times[msg] = (cpu_t - enter_cpu_times[msg]);

#ifdef PROFILE_OP_COUNTS
    for (std::pair<std::string, long long*> p : op_data_points)
    {
        cumulative_op_counts[std::make_pair(msg, p.first)] += *(p.second)-op_counts[std::make_pair(msg, p.first)];
    }
#endif

    if (inhibit_profiling_info)
    {
        return;
    }

#ifdef MULTICORE
#pragma omp critical
#endif
    {
        if (indent)
        {
            --indentation;
        }

        print_indent();
        printf("(leave) %-35s\t", msg.c_str());
        print_times_from_last_and_start(t, enter_times[msg], cpu_t, enter_cpu_times[msg]);
        print_op_profiling(msg);
        printf("\n");
        fflush(stdout);
    }
}
Ejemplo n.º 2
0
void leave_block(const std::string &msg, const bool indent)
{
    if (inhibit_profiling_counters)
    {
        return;
    }

#ifndef MULTICORE
    assert(*(--block_names.end()) == msg);
#endif
    block_names.pop_back();

    ++invocation_counts[msg];

    timespec t;
    clock_gettime(CLOCK_REALTIME, &t);
    last_times[msg] = nsec_diff(t, enter_times[msg]);
    cumulative_times[msg] += nsec_diff(t, enter_times[msg]);

#ifdef PROFILE_OP_COUNTS
    for (std::pair<std::string, long long*> p : op_data_points)
    {
        cumulative_op_counts[std::make_pair(msg, p.first)] += *(p.second)-op_counts[std::make_pair(msg, p.first)];
    }
#endif

    if (inhibit_profiling_info)
    {
        return;
    }
#pragma omp critical
    {
        if (indent)
        {
            --indentation;
        }

        print_indent();
        printf("(leave) %-35s\t[%0.4fs]\t(%0.4fs from start)",
               msg.c_str(), nsec_diff(t, enter_times[msg]) * 1e-9, nsec_diff(t, start_time) * 1e-9);
        print_op_profiling(msg);
        printf("\n");
        fflush(stdout);
    }
}
Ejemplo n.º 3
0
void print_time(const char* msg)
{
    if (inhibit_profiling_info)
    {
        return;
    }

    long long t = get_nsec_time();

    printf("%-35s\t[%0.4fs]\t(%0.4fs from start)",
           msg, (t - last_time) * 1e-9, (t - start_time) * 1e-9);

#ifdef PROFILE_OP_COUNTS
    print_op_profiling(msg);
#endif
    printf("\n");

    fflush(stdout);
    last_time = t;
}
Ejemplo n.º 4
0
void print_time(const char* msg)
{
    if (inhibit_profiling_info)
    {
        return;
    }

    timespec t;
    clock_gettime(CLOCK_REALTIME, &t);

    printf("%-35s\t[%0.4fs]\t(%0.4fs from start)",
           msg, nsec_diff(t, last_time) * 1e-9, nsec_diff(t, start_time) * 1e-9);

#ifdef PROFILE_OP_COUNTS
    print_op_profiling(msg);
#endif
    printf("\n");

    fflush(stdout);
    last_time = t;
}
void print_time(const char* msg)
{
    if (inhibit_profiling_info)
    {
        return;
    }

    long long now = get_nsec_time();
    long long cpu_now = get_nsec_cpu_time();

    printf("%-35s\t", msg);
    print_times_from_last_and_start(now, last_time, cpu_now, last_cpu_time);
#ifdef PROFILE_OP_COUNTS
    print_op_profiling(msg);
#endif
    printf("\n");

    fflush(stdout);
    last_time = now;
    last_cpu_time = cpu_now;
}