Пример #1
0
void enter_block(const std::string &msg, const bool indent)
{
    if (inhibit_profiling_counters)
    {
        return;
    }

    block_names.emplace_back(msg);
    timespec t;
    clock_gettime(CLOCK_REALTIME, &t);
    enter_times[msg] = t;

    if (inhibit_profiling_info)
    {
        return;
    }
#pragma omp critical
    {
        op_profiling_enter(msg);

        print_indent();
        printf("(enter) %-35s\t[0s]\t(%0.4fs from start)\n",
               msg.c_str(), nsec_diff(t, start_time) * 1e-9);
        fflush(stdout);

        if (indent)
        {
            ++indentation;
        }
    }
}
Пример #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);
    }
}
Пример #3
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;
}
Пример #4
0
double get_time()
{
    timespec t;
    clock_gettime(CLOCK_REALTIME, &t);
    return nsec_diff(t, start_time) * 1e-9;
}
Пример #5
0
double rt_time_t::nsec_since_snap() const {
	rt_time_t t_aux;
	t_aux.snap_time();
	return nsec_diff(*this, t_aux);
}