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 <cxxabi.h> | |
#include <typeinfo> | |
void main(){ | |
int status; | |
char * producerType = abi::__cxa_demangle(typeid(someType).name(),0,0,&status); | |
char * consumerType = abi::__cxa_demangle(typeid(someType).name(),0,0,&status); | |
std::cout << "Producer type: " << producerType << "\n"; | |
std::cout << "Consumer type: " << consumerType << "\n"; | |
free(producerType); |
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
// Provides a C++11 implementation of a multi-producer, multi-consumer lock-free queue. | |
// An overview, including benchmark results, is provided here: | |
// http://moodycamel.com/blog/2014/a-fast-general-purpose-lock-free-queue-for-c++ | |
// The full design is also described in excruciating detail at: | |
// http://moodycamel.com/blog/2014/detailed-design-of-a-lock-free-queue | |
// Simplified BSD license: | |
// Copyright (c) 2013-2015, Cameron Desrochers. | |
// All rights reserved. |
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
//// to compile: c++ bench.cpp -o bench -Wall -Wshadow -Wextra -pedantic -std=c++11 -pthread -I../include -O3 -fPIC -Ofast -m64 -march=native | |
// Alternative: c++ bench.cpp -o bench -Wall -Wshadow -Wextra -pedantic -std=c++11 -pthread -I../include -O3 -march=native | |
// the test code itself is Public domain @ref: Unlicense.org | |
// made by KjellKod, 2015, first published for testing of g3log at github.com/kjellkod/g3log | |
// Feel free to share, modify etc with no obligations but also with no guarantees from my part either | |
// enjoy - Kjell Hedstrom (aka KjellKod) | |
// |
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
// Public domain @ref: Unlicense.org | |
// made by KjellKod, 2015. Feel free to share, modify etc with no obligations but also with no guarantees from my part either | |
// enjoy - Kjell Hedstrom (aka KjellKod) | |
// | |
// c++ main_worst_case_latench.cpp -fPIC -Ofast -m64 -march=native -Wall -std=c++11 -stdlib=libc++ -Wunused -o g3log-bench -Ig3log/src/ g3log/build/libg3logger.a | |
// OR: c++ main_worst_case_latench.cpp -O3 -march=native -Wall -std=c++11 -stdlib=libc++ -Wunused -o g3log-bench -Ig3log/src/ g3log/build/libg3logger.a | |
#include <thread> | |
#include <vector> | |
#include <atomic> |
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
// c++ thisfile.cpp -fPIC -Ofast -m64 -march=native -Wall -std=c++11 -stdlib=libc++ -Wunused -o g3log-bench -Ig3log/src/ g3log/build/libg3logger.a | |
// Public domain @ref: Unlicense.org | |
// made by KjellKod, 2015. Feel free to share, modify etc with no obligations but also with no guarantees from my part either | |
// enjoy - Kjell Hedstrom (aka KjellKod) | |
#include <thread> | |
#include <vector> |
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
//// to compile: c++ bench.cpp -o bench -Wall -Wshadow -Wextra -pedantic -std=c++11 -pthread -I../include -O3 -fPIC -Ofast -m64 -march=native | |
// Alternative: c++ bench.cpp -o bench -Wall -Wshadow -Wextra -pedantic -std=c++11 -pthread -I../include -O3 -march=native | |
// the test code itself is Public domain @ref: Unlicense.org | |
// made by KjellKod, 2015, first published for testing of g3log at github.com/kjellkod/g3log | |
// Feel free to share, modify etc with no obligations but also with no guarantees from my part either | |
// enjoy - Kjell Hedstrom (aka KjellKod) | |
// |