2019-12-20 04:41:53 +00:00
|
|
|
// Prototypes for executing builtin_time function.
|
|
|
|
#ifndef FISH_TIMER_H
|
|
|
|
#define FISH_TIMER_H
|
|
|
|
|
|
|
|
#include <sys/resource.h>
|
2019-12-29 22:25:42 +00:00
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <chrono>
|
2019-12-20 04:41:53 +00:00
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
class parser_t;
|
|
|
|
struct io_streams_t;
|
|
|
|
|
2019-12-21 10:45:07 +00:00
|
|
|
cleanup_t push_timer(bool enabled);
|
|
|
|
|
2019-12-20 04:41:53 +00:00
|
|
|
struct timer_snapshot_t {
|
2019-12-29 22:25:42 +00:00
|
|
|
public:
|
2019-12-20 04:41:53 +00:00
|
|
|
struct rusage cpu_fish;
|
|
|
|
struct rusage cpu_children;
|
|
|
|
std::chrono::time_point<std::chrono::steady_clock> wall;
|
|
|
|
|
|
|
|
static timer_snapshot_t take();
|
|
|
|
static wcstring print_delta(timer_snapshot_t t1, timer_snapshot_t t2, bool verbose = false);
|
|
|
|
|
2019-12-29 22:25:42 +00:00
|
|
|
private:
|
2019-12-20 04:41:53 +00:00
|
|
|
timer_snapshot_t() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|