In order to gen call graph in perf:
-fno-omit-frame-butter
#Generate perf.data for executable perf record -g executable #0.5 is a filter?, caller is inverse the graph callstack perf report -g 'graph,0.5,caller'
Prevent optimizer to remove code:
| use warnings; | |
| use strict; | |
| $_ = 'abcdefghi'; | |
| # s/./ substr $_, -$+[0], 1 /eg; # duh, substr and array | |
| # s#.# /(.).{$-[0]}$/; $1 #eg; # duh, array | |
| my $x = 0; s#.# /(.).{$x}$/; $x++; $1 #eg; |
| ###################### | |
| ## shadowsocks-libev | |
| ###################### | |
| # install dependencies | |
| yum install epel-release -y | |
| yum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto udns-devel libev-devel -y | |
| # install shadowsocks-libev | |
| cd /etc/yum.repos.d/ |
| MSYS2: | |
| pacman -S base-devel mingw64/mingw-w64-x86_64-cmake mingw-w64-x86_64-gtk3 mingw-w64-x86_64-gtkmm3 mingw-w64-x86_64-pkg-config | |
| #Optional: pacman -S mingw-w64-x86_64-glade | |
| #In .bashrc | |
| export PATH=/mingw64/bin:$PATH | |
| export PKG_CONFIG_PATH=/mingw64/lib/pkgconfig | |
| Compiler: | |
| Option 1: Use MSYS2 GCC | |
| pacman -S mingw-w64-x86_64-gcc |
| bcdedit /set hypervisorlaunchtype off | |
| bcdedit /set hypervisorlaunchtype auto | |
| bcdedit | |
| #hypervisorlaunchtype Auto |
| //Template Type Check | |
| template<typename T, typename F, | |
| typename = std::enable_if_t<std::is_invocable<F, T>::value> > | |
| void foo() | |
| {} | |
| template<typename T, typename F, | |
| typename = typename std::enable_if<std::is_invocable<F, T>::value>::type > | |
| void foo() | |
| {} |
| #include <iostream> | |
| #include <string> | |
| #include <vector> | |
| #include <functional> | |
| #include <type_traits> | |
| template <typename T, typename = void> | |
| struct is_iterable : std::false_type {}; | |
| template <typename T> |
| std::unordered_map<void*, size_t> *auto_ref_cnt; | |
| template<typename T> | |
| class AutoPtr { | |
| T * data; | |
| public: | |
| AutoPtr() = delete; | |
| AutoPtr(T* data): data(data) { | |
| if(auto_ref_cnt == nullptr) { | |
| auto_ref_cnt = new std::unordered_map<void*, size_t>; |
| -fno-omit-frame-pointer | |
| -std=c++17 | |
| -pedantic |
In order to gen call graph in perf:
-fno-omit-frame-butter
#Generate perf.data for executable perf record -g executable #0.5 is a filter?, caller is inverse the graph callstack perf report -g 'graph,0.5,caller'
Prevent optimizer to remove code:
| /* Ambiguous | |
| def compare[T1, T2](a: T1, b: T2)(implicit ev: T1 => T2) = compareImpl[T2](ev(a), b) | |
| def compare[T1, T2](a: T1, b: T2)(implicit ev: T2 => T1) = compareImpl[T1](a, ev(b)) | |
| def compareImpl[T](a: T, b: T) = a == b | |
| */ | |
| import scala.reflect.runtime.universe._ | |
| import scala.reflect.macros.blackbox.Context | |
| import scala.language.experimental.macros | |
| import scala.language.implicitConversions |