generated from ucu-cs/template_cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8306a1f
commit fa9cbee
Showing
8 changed files
with
92 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// Created by mykola on 22.04.24. | ||
// | ||
|
||
#ifndef COUNTWORDS_PAR_PROFTOOLS_ERRCODE_EXCEPTION_H | ||
#define COUNTWORDS_PAR_PROFTOOLS_ERRCODE_EXCEPTION_H | ||
|
||
#include <exception> | ||
#include <string> | ||
|
||
class errcode_exception: public std::exception { | ||
private: | ||
int m_err_code; | ||
std::string m_message; | ||
|
||
public: | ||
errcode_exception(int err_code, std::string_view msg): m_message(msg), m_err_code(err_code) {} | ||
|
||
[[nodiscard]] const char* what() const noexcept override; | ||
[[nodiscard]] int err_code() const noexcept; | ||
}; | ||
|
||
#endif //COUNTWORDS_PAR_PROFTOOLS_ERRCODE_EXCEPTION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Created by mykola on 22.04.24. | ||
// | ||
|
||
#ifndef COUNTWORDS_PAR_PROFTOOLS_TIME_MEASURE_H | ||
#define COUNTWORDS_PAR_PROFTOOLS_TIME_MEASURE_H | ||
|
||
#include <chrono> | ||
#include <atomic> | ||
|
||
inline std::chrono::high_resolution_clock::time_point | ||
get_current_time_fenced() | ||
{ | ||
std::atomic_thread_fence(std::memory_order_seq_cst); | ||
auto res_time = std::chrono::high_resolution_clock::now(); | ||
std::atomic_thread_fence(std::memory_order_seq_cst); | ||
return res_time; | ||
} | ||
|
||
template<class D> | ||
inline long long to_ms(const D& d) | ||
{ | ||
return std::chrono::duration_cast<std::chrono::milliseconds>(d).count(); | ||
} | ||
|
||
#endif //COUNTWORDS_PAR_PROFTOOLS_TIME_MEASURE_H |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Created by mykola on 22.04.24. | ||
// | ||
|
||
#include "errcode_exception.h" | ||
|
||
const char* errcode_exception::what() const noexcept { | ||
return m_message.c_str(); | ||
} | ||
|
||
int errcode_exception::err_code() const noexcept { | ||
return m_err_code; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters