forked from gabime/spdlog
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from jkoelker/hunter
Sync with upstream releases
- Loading branch information
Showing
42 changed files
with
2,337 additions
and
1,044 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
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,32 @@ | ||
CXX ?= g++ | ||
CXXFLAGS = -march=native -Wall -std=c++11 -pthread | ||
CXX_RELEASE_FLAGS = -O2 -DNDEBUG | ||
|
||
|
||
binaries=spdlog-latency g3log-latency g3log-crush | ||
|
||
all: $(binaries) | ||
|
||
spdlog-latency: spdlog-latency.cpp | ||
$(CXX) spdlog-latency.cpp -o spdlog-latency $(CXXFLAGS) $(CXX_RELEASE_FLAGS) -I../../include | ||
|
||
|
||
|
||
g3log-latency: g3log-latency.cpp | ||
$(CXX) g3log-latency.cpp -o g3log-latency $(CXXFLAGS) $(CXX_RELEASE_FLAGS) -I../../../g3log/src -L. -lg3logger | ||
|
||
|
||
g3log-crush: g3log-crush.cpp | ||
$(CXX) g3log-crush.cpp -o g3log-crush $(CXXFLAGS) $(CXX_RELEASE_FLAGS) -I../../../g3log/src -L. -lg3logger | ||
|
||
|
||
.PHONY: clean | ||
|
||
clean: | ||
rm -f *.o *.log $(binaries) | ||
|
||
|
||
rebuild: clean all | ||
|
||
|
||
|
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 @@ | ||
#!/bin/bash | ||
echo "running spdlog and g3log tests 10 time with ${1:-10} threads each (total 1,000,000 entries).." | ||
rm -f *.log | ||
for i in {1..10} | ||
|
||
do | ||
echo | ||
sleep 0.5 | ||
./spdlog-latency ${1:-10} 2>/dev/null || exit | ||
sleep 0.5 | ||
./g3log-latency ${1:-10} 2>/dev/null || exit | ||
|
||
done |
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,37 @@ | ||
#include <iostream> | ||
|
||
#include <g3log/g3log.hpp> | ||
#include <g3log/logworker.hpp> | ||
|
||
void CrusherLoop() | ||
{ | ||
size_t counter = 0; | ||
while (true) | ||
{ | ||
LOGF(INFO, "Some text to crush you machine. thread:"); | ||
if(++counter % 1000000 == 0) | ||
{ | ||
std::cout << "Wrote " << counter << " entries" << std::endl; | ||
} | ||
} | ||
} | ||
|
||
|
||
int main(int argc, char** argv) | ||
{ | ||
std::cout << "WARNING: This test will exaust all your machine memory and will crush it!" << std::endl; | ||
std::cout << "Are you sure you want to continue ? " << std::endl; | ||
char c; | ||
std::cin >> c; | ||
if (toupper( c ) != 'Y') | ||
return 0; | ||
|
||
auto worker = g3::LogWorker::createLogWorker(); | ||
auto handle= worker->addDefaultLogger(argv[0], "g3log.txt"); | ||
g3::initializeLogging(worker.get()); | ||
CrusherLoop(); | ||
|
||
return 0; | ||
} | ||
|
||
|
Oops, something went wrong.