Comment the Utils section
This commit is contained in:
parent
51c3203fda
commit
1cf6795130
1
Makefile
1
Makefile
@ -3,6 +3,7 @@ CONFIG ?= gcc
|
||||
PREFIX ?= /usr
|
||||
SOURCES_FILE := Sources.mk
|
||||
|
||||
-include config.mk
|
||||
include $(SOURCES_FILE)
|
||||
include ./etc/make/emacs.mk
|
||||
include ./etc/config/$(CONFIG).mk
|
||||
|
||||
27
atrip.org
27
atrip.org
@ -710,6 +710,9 @@ std::ostream& operator<<(std::ostream& out, Slice::Info const& i) {
|
||||
#+end_src
|
||||
|
||||
** Utils
|
||||
|
||||
This section presents some utilities
|
||||
*** Prolog :noexport:
|
||||
#+begin_src c++ :tangle (atrip-utils-h)
|
||||
#pragma once
|
||||
#include <sstream>
|
||||
@ -720,8 +723,13 @@ std::ostream& operator<<(std::ostream& out, Slice::Info const& i) {
|
||||
#include <ctf.hpp>
|
||||
|
||||
namespace atrip {
|
||||
#+end_src
|
||||
|
||||
*** Pretty printing
|
||||
|
||||
The pretty printing uses the [[https://github.com/sharkdp/dbg-macro][dbg-macro]] package.
|
||||
|
||||
#+begin_src c++ :tangle (atrip-utils-h)
|
||||
template <typename T>
|
||||
std::string pretty_print(T&& value) {
|
||||
std::stringstream stream;
|
||||
@ -731,8 +739,18 @@ namespace atrip {
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
#+end_src
|
||||
|
||||
*** Chrono
|
||||
|
||||
The chrono is just a simple wrapper for a high resolution clock
|
||||
that can be found in the =std::chrono= namespace of the standard library.
|
||||
|
||||
#+begin_src c++ :tangle (atrip-utils-h)
|
||||
#define WITH_CHRONO(__chrono, ...) \
|
||||
__chrono.start(); __VA_ARGS__ __chrono.stop();
|
||||
__chrono.start(); \
|
||||
__VA_ARGS__ \
|
||||
__chrono.stop();
|
||||
|
||||
struct Timer {
|
||||
using Clock = std::chrono::high_resolution_clock;
|
||||
@ -745,10 +763,15 @@ namespace atrip {
|
||||
inline double count() const noexcept { return duration.count(); }
|
||||
};
|
||||
using Timings = std::map<std::string, Timer>;
|
||||
}
|
||||
|
||||
#+end_src
|
||||
|
||||
|
||||
*** Epilog :noexport:
|
||||
#+begin_src c++ :tangle (atrip-utils-h)
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** The rank mapping
|
||||
|
||||
This section introduces the concept of rank mapping,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// [[file:../../atrip.org::*Utils][Utils:1]]
|
||||
// [[file:../../atrip.org::*Prolog][Prolog:1]]
|
||||
#pragma once
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@ -8,8 +8,9 @@
|
||||
#include <ctf.hpp>
|
||||
|
||||
namespace atrip {
|
||||
// Prolog:1 ends here
|
||||
|
||||
|
||||
// [[file:../../atrip.org::*Pretty printing][Pretty printing:1]]
|
||||
template <typename T>
|
||||
std::string pretty_print(T&& value) {
|
||||
std::stringstream stream;
|
||||
@ -18,9 +19,13 @@ namespace atrip {
|
||||
#endif
|
||||
return stream.str();
|
||||
}
|
||||
// Pretty printing:1 ends here
|
||||
|
||||
// [[file:../../atrip.org::*Chrono][Chrono:1]]
|
||||
#define WITH_CHRONO(__chrono, ...) \
|
||||
__chrono.start(); __VA_ARGS__ __chrono.stop();
|
||||
__chrono.start(); \
|
||||
__VA_ARGS__ \
|
||||
__chrono.stop();
|
||||
|
||||
struct Timer {
|
||||
using Clock = std::chrono::high_resolution_clock;
|
||||
@ -33,5 +38,8 @@ namespace atrip {
|
||||
inline double count() const noexcept { return duration.count(); }
|
||||
};
|
||||
using Timings = std::map<std::string, Timer>;
|
||||
// Chrono:1 ends here
|
||||
|
||||
// [[file:../../atrip.org::*Epilog][Epilog:1]]
|
||||
}
|
||||
// Utils:1 ends here
|
||||
// Epilog:1 ends here
|
||||
|
||||
Loading…
Reference in New Issue
Block a user