View clobber.c
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
// gcc -O3 -S -masm=intel -fverbose-asm test.c | |
// (code : out : in : clobber) | |
asm volatile ("" :: "g"(&a) : "memory"); | |
// see also: https://www.youtube.com/watch?v=nXaxk27zwlk |
View strconv.cpp
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
#include <cstring> | |
#include <cmath> | |
#include <cstdio> | |
#include <ctime> | |
#include <cstdlib> | |
#include <sstream> | |
#define NITER 5000000 | |
int main() { |
View zero.cpp
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
#include <cstring> | |
#include <cmath> | |
#include <cstdio> | |
#include <ctime> | |
#include <cstdlib> | |
#include <vector> | |
#define NITER 100//5000000 | |
int main() { | |
clock_t t; |
View genasm.mk
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
g++ -std=c++11 -O3 -S -masm=intel -fverbose-asm main.cpp # -mllvm --x86-asm-syntax=intel |
View perf_profile.sh
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
#!/bin/sh | |
# compile with -fno-omit-frame-pointer | |
# usermode | |
sudo sh -c "echo 0 > /proc/sys/kernel/kptr_restrict" | |
sudo sh -c 'echo 1 >/proc/sys/kernel/perf_event_paranoid' | |
# record with callgraph | |
perf record -g $1 | |
# display with inverse callgraph | |
perf report -g 'graph,0.5,caller' |
View vulkan.cpp
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
#include <SDL2/SDL.h> | |
#include <SDL2/SDL_vulkan.h> | |
#include <vulkan/vulkan.hpp> | |
#include <algorithm> | |
VkBool32 debug_callback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, | |
VkDebugUtilsMessageTypeFlagsEXT messageTypes, | |
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, void* pUserData) | |
{ | |
auto types = vk::to_string((vk::DebugUtilsMessageTypeFlagsEXT)messageTypes); |
View launch.json
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
{ | |
// launch python through GDB to break in CPP code | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "GDB Python: Current File", | |
"type": "cppdbg", | |
"request": "launch", | |
"program": "/usr/bin/python", | |
"args": [ |