A library for working with phylogenetic and population genetic data.
v0.32.0
info.cpp File Reference
#include "genesis/utils/core/info.hpp"
#include "genesis/utils/core/fs.hpp"
#include "genesis/utils/core/logging.hpp"
#include "genesis/utils/core/options.hpp"
#include "genesis/utils/core/version.hpp"
#include "genesis/utils/text/string.hpp"
#include <algorithm>
#include <cassert>
#include <cctype>
#include <chrono>
#include <climits>
#include <cstdarg>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <string>
#include <thread>
#include <unordered_set>
#include <vector>
#include <errno.h>
#include <stdio.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::utils
 

Functions

bool detect_OS_AVX512_ ()
 
bool detect_OS_AVX_ ()
 
bool detect_OS_x64_ ()
 
size_t get_core_id_ (std::string const &cpu_path)
 
std::string get_cpu_model_ ()
 
void get_cpuid_ (int32_t out[4], int32_t eax, int32_t ecx)
 
size_t get_memtotal_ ()
 
size_t get_numa_node_id_ (std::string const &cpu_path)
 
int get_physical_core_count_ (size_t n_cpu)
 
std::string get_vendor_string_ ()
 
size_t guess_number_of_threads (bool use_openmp=true, bool use_slurm=true, bool physical_cores=true)
 Make an educated guess on the number of threads to use for multi-threaded functionality. More...
 
InfoCompiler const & info_get_compiler ()
 Return information about compiler settings and flags. More...
 
InfoHardware const & info_get_hardware ()
 Return information about hardware features. More...
 
size_t info_get_pid ()
 Get the process ID of the current process. More...
 
bool info_hyperthreads_enabled ()
 Try to get whether hyperthreads are enabled in the current system. More...
 
size_t info_number_of_threads_openmp ()
 Get the number of threads as indicated by the OpenMP environment. More...
 
size_t info_number_of_threads_slurm ()
 Get the number of threads as indicated by the SLURM environment. More...
 
long info_online_cpu_cores ()
 
size_t info_physical_core_count ()
 Get the number of CPU cores. More...
 
std::unordered_map< std::string, std::string > const & info_preprocessor_definitions ()
 Return a string map with some relevant preprocessor macros. More...
 
std::string info_print_compiler ()
 Print information about compiler settings and flags to a string. More...
 
std::string info_print_hardware (bool full=false)
 Print information about hardware features to a string. More...
 
double info_process_current_cpu_usage (bool all_cores=true, bool percent=true)
 Return the CPU usage of the current process. More...
 
size_t info_process_current_file_count ()
 Return the number of files (i.e., file descriptors) that the current process (the process calling this function) has opened at the moment. More...
 
size_t info_process_current_memory_usage ()
 Return the memory currently used by the current process, in bytes. More...
 
size_t info_process_max_file_count ()
 Return the maximum number of files (i.e., file descriptors) that can be opened simultaneously in the current process. More...
 
size_t info_process_peak_memory_usage ()
 Get the peak used memory, in bytes. More...
 
std::string info_process_print_total_usage ()
 Print usage information to a string. More...
 
std::pair< double, double > info_process_total_cpu_time ()
 Get the currently used cpu run time, similar to the Unix time command. More...
 
double info_process_total_energy_consumption ()
 Get energy consumption of the program so far, in Wh. More...
 
bool info_stderr_is_terminal ()
 Return true iff the standard error stream is a terminal, and false if not, i.e., if it is a file or a pipe. More...
 
bool info_stdin_is_terminal ()
 Return true iff the standard input stream is a terminal, and false if not, i.e., if it is a file or a pipe. More...
 
bool info_stdout_is_terminal ()
 Return true iff the standard output stream is a terminal, and false if not, i.e., if it is a file or a pipe. More...
 
double info_system_current_cpu_usage (bool all_cores=true, bool percent=true)
 Return the CPU usage of the system, across all cores. More...
 
size_t info_system_current_memory_available ()
 Return the memory currently available in the system, in bytes. More...
 
size_t info_system_current_memory_usage ()
 Return the memory currently used across all running processes, in bytes. More...
 
unsigned int info_task_cpu_cores (bool physical=false)
 
std::pair< int, int > info_terminal_size ()
 Return the width and height of the terminal that is used to run the program, in number of columns and lines. More...
 
bool info_use_avx ()
 Assess if it is safe to use AVX features. More...
 
bool info_use_avx2 ()
 Assess if it is safe to use AVX2 features. More...
 
bool info_use_avx512 ()
 Assess if it is safe to use AVX512 features. More...
 
size_t read_id_from_file_ (std::string const &filename)
 
uint64_t xgetbv (unsigned int index)