128 auto end = std::chrono::high_resolution_clock::now();
129 auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(end -
start_time);
142 start_time = std::chrono::high_resolution_clock::now();
187 auto end = std::clock();
T * alloc_to_device(size_t size)
Allocates memory on the CUDA device.
static const std::string GENETIC_DATA_DIRECTORY
Directory path for storing data related to genetic datasets.
static const std::string REMOVAL_DATA_FILENAME
Base filename prefix for removal performance data files.
static const std::string SYNTHETIC_DATA_DIRECTORY
Directory path for storing data related to synthetic datasets.
static const std::string CSV_EXTENSION
Standard file extension for Comma Separated Value files.
static const std::string SEARCH_DATA_FILENAME
Base filename prefix for search performance data files.
std::string get_hostname()
Retrieves the hostname of the machine executing the code.
void save_removal_data(const std::string &method, size_t n, size_t m, size_t l, size_t num_nanoseconds, size_t num_repetitions=1, size_t min_par_compare=0, bool is_genetic=false)
Saves removal performance data to a CSV file.
void save_search_data(const std::string &method, size_t n, size_t m, size_t l, size_t num_nanoseconds, size_t num_repetitions=1, size_t min_par_compare=0, bool is_genetic=false)
Saves search performance data to a CSV file.
static const std::string CONSTRUCTION_DATA_FILENAME
Base filename prefix for construction performance data files.
void save_construction_data(const std::string &method, size_t n, size_t m, size_t l, size_t num_nanoseconds, size_t num_repetitions=1, size_t min_par_compare=0, bool is_genetic=false)
Saves construction performance data to a CSV file.
std::string pretty_print(size_t nanoseconds)
Converts a duration in nanoseconds to a human-readable string format.
static const std::string HOSTNAME
Constant string storing the hostname, retrieved once at program startup.
const std::string & get_data_directory(bool is_genetic=false)
Gets the appropriate data directory path based on the data type.
A timer class measuring CPU time used by the current process using std::clock().
size_t print() noexcept
Prints the elapsed CPU time since the last start/reset to stdout.
void start(const std::string &prompt="", bool reset=true) noexcept
Starts or resets the CPU timer and optionally prints a starting message.
CPUTimer()=default
Default constructor.
size_t elapsed_nanoseconds() const noexcept
Calculates the elapsed CPU time since the timer was started.
A timer class measuring wall-clock time using std::chrono::high_resolution_clock.
size_t print() noexcept
Prints the elapsed time since the last start/reset to stdout.
void start(const std::string &prompt="", bool reset=true) noexcept
Starts or resets the timer and optionally prints a starting message.
WallTimer()=default
Default constructor.
std::chrono::high_resolution_clock::time_point start_time
size_t elapsed_nanoseconds() const noexcept
Calculates the elapsed time since the timer was started.