forked from ShawnZhong/MadFS
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdebug.h
More file actions
24 lines (19 loc) · 780 Bytes
/
debug.h
File metadata and controls
24 lines (19 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once
#include <chrono>
#include <cstddef>
#include "const.h"
#include "utils/timer_event.h"
namespace madfs {
// The following functions are intended for debug usage. They are declared as
// weak so other program can include this header without having to link with the
// library. One need to check `is_linked` before using them.
namespace debug {
void print_file(int fd) __attribute__((weak));
size_t get_count(Event event) __attribute__((weak));
size_t get_size(Event event) __attribute__((weak));
std::chrono::nanoseconds get_duration(Event event) __attribute__((weak));
void clear_timer() __attribute__((weak));
void print_timer() __attribute__((weak));
} // namespace debug
static bool is_linked() { return debug::print_file != nullptr; }
} // namespace madfs