Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
135d0e22
Commit
135d0e22
authored
Nov 24, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
g2log benchmarks
parent
0926a6e2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
29 deletions
+93
-29
Makefile
bench/Makefile
+10
-1
g2log-bench-mt.cpp
bench/g2log-bench-mt.cpp
+49
-0
g2log-bench.cpp
bench/g2log-bench.cpp
+16
-0
run_all.bat
bench/run_all.bat
+0
-28
run_all.sh
bench/run_all.sh
+18
-0
No files found.
bench/Makefile
View file @
135d0e22
...
@@ -3,7 +3,7 @@ CXXFLAGS = -march=native -Wall -Wextra -Wshadow -pedantic -std=c++11 -pthread -W
...
@@ -3,7 +3,7 @@ CXXFLAGS = -march=native -Wall -Wextra -Wshadow -pedantic -std=c++11 -pthread -W
CXX_RELEASE_FLAGS
=
-O3
-flto
CXX_RELEASE_FLAGS
=
-O3
-flto
all
:
spdlog-bench spdlog-bench-mt spdlog-bench-async spdlog-bench-mt-async boost-bench boost-bench-mt glog-bench glog-bench-mt
all
:
spdlog-bench spdlog-bench-mt spdlog-bench-async spdlog-bench-mt-async boost-bench boost-bench-mt glog-bench glog-bench-mt
g2log-bench g2log-bench-mt
spdlog-bench
:
spdlog-bench.cpp
spdlog-bench
:
spdlog-bench.cpp
$(CXX)
spdlog-bench.cpp
-o
spdlog-bench
$(CXXFLAGS)
$(CXX_RELEASE_FLAGS)
$(CXX)
spdlog-bench.cpp
-o
spdlog-bench
$(CXXFLAGS)
$(CXX_RELEASE_FLAGS)
...
@@ -34,6 +34,15 @@ glog-bench-mt: glog-bench-mt.cpp
...
@@ -34,6 +34,15 @@ glog-bench-mt: glog-bench-mt.cpp
$(CXX)
glog-bench-mt.cpp
-o
glog-bench-mt
$(CXXFLAGS)
$(GLOG_FLAGS)
$(CXX_RELEASE_FLAGS)
$(CXX)
glog-bench-mt.cpp
-o
glog-bench-mt
$(CXXFLAGS)
$(GLOG_FLAGS)
$(CXX_RELEASE_FLAGS)
G2LOG_FLAGS
=
-I
/home/gabi/devel/g2log/g2log/src
-L
/home/gabi/devel/g2log/g2log
-llib_g2logger
g2log-bench
:
g2log-bench.cpp
$(CXX)
g2log-bench.cpp
-o
g2log-bench
$(CXXFLAGS)
$(G2LOG_FLAGS)
$(CXX_RELEASE_FLAGS)
g2log-bench-mt
:
g2log-bench-mt.cpp
$(CXX)
g2log-bench-mt.cpp
-o
g2log-bench-mt
$(CXXFLAGS)
$(G2LOG_FLAGS)
$(CXX_RELEASE_FLAGS)
clean
:
clean
:
rm
-f
*
.o logs/
*
spdlog-bench spdlog-bench-mt boost-bench boost-bench-mt glog-bench
rm
-f
*
.o logs/
*
spdlog-bench spdlog-bench-mt boost-bench boost-bench-mt glog-bench
...
...
bench/g2log-bench-mt.cpp
0 → 100644
View file @
135d0e22
#include <thread>
#include <vector>
#include <atomic>
#include <iostream>
#include "g2logworker.h"
#include "g2log.h"
using
namespace
std
;
int
main
(
int
argc
,
char
*
argv
[])
{
int
thread_count
=
10
;
if
(
argc
>
1
)
thread_count
=
atoi
(
argv
[
1
]);
int
howmany
=
1000000
;
g2LogWorker
g2log
(
argv
[
0
],
"logs"
);
g2
::
initializeLogging
(
&
g2log
);
std
::
atomic
<
int
>
msg_counter
{
0
};
vector
<
thread
>
threads
;
for
(
int
t
=
0
;
t
<
thread_count
;
++
t
)
{
threads
.
push_back
(
std
::
thread
([
&
]()
{
while
(
true
)
{
int
counter
=
++
msg_counter
;
if
(
counter
>
howmany
)
break
;
LOG
(
INFO
)
<<
"glog message #"
<<
counter
<<
": This is some text for your pleasure"
;
}
}));
}
for
(
auto
&
t
:
threads
)
{
t
.
join
();
};
return
0
;
}
bench/g2log-bench.cpp
0 → 100644
View file @
135d0e22
#include "g2logworker.h"
#include "g2log.h"
int
main
(
int
,
char
*
argv
[])
{
int
howmany
=
1000000
;
g2LogWorker
g2log
(
argv
[
0
],
"logs"
);
g2
::
initializeLogging
(
&
g2log
);
for
(
int
i
=
0
;
i
<
howmany
;
++
i
)
LOG
(
INFO
)
<<
"g2log message # "
<<
i
<<
": This is some text for your pleasure"
;
return
0
;
}
bench/run_all.bat
deleted
100644 → 0
View file @
0926a6e2
@echo off
echo Running benchmarks (all with 1000,000 writes to the logs folder)
echo ==================================
echo boost-bench (single thread)
echo %time%
.\boost-bench
echo %time%
echo ==================================
choice /n /c y /d y /t 1 >NUL
echo spdlog-bench (single thread)
echo %time%
.\spdlog-bench
echo %time%
echo ==================================
choice /n /c y /d y /t 1 >NUL
echo boost-bench-mt (10 threads, single logger)
echo %time%
.\boost-bench-mt
echo %time%
echo ==================================
choice /n /c y /d y /t 1 >NUL
echo spdlog-bench-mt (10 threads, single logger)
echo %time%
.\spdlog-bench-mt
echo %time%
echo ==================================
bench/run_all.sh
View file @
135d0e22
...
@@ -6,31 +6,49 @@ time ./boost-bench
...
@@ -6,31 +6,49 @@ time ./boost-bench
echo
echo
echo
echo
sleep
3
sleep
3
echo
"glog-bench (single thread).."
echo
"glog-bench (single thread).."
time
./glog-bench
time
./glog-bench
echo
echo
echo
echo
sleep
3
sleep
3
echo
"g2log-bench (single thread).."
time
./g2log-bench
echo
echo
sleep
3
echo
"spdlog-bench (single thread)"
echo
"spdlog-bench (single thread)"
time
./spdlog-bench
time
./spdlog-bench
echo
echo
echo
echo
sleep
3
sleep
3
echo
"boost-bench-mt (10 threads, single logger)"
..
echo
"boost-bench-mt (10 threads, single logger)"
..
time
./boost-bench-mt
time
./boost-bench-mt
echo
echo
echo
echo
sleep
3
sleep
3
echo
"glog-bench-mt (10 threads, single logger)"
..
echo
"glog-bench-mt (10 threads, single logger)"
..
time
./glog-bench-mt
time
./glog-bench-mt
echo
echo
echo
echo
sleep
3
sleep
3
echo
"g2log-bench-mt (10 threads, single logger)"
..
time
./g2log-bench-mt
echo
echo
sleep
3
echo
"spdlog-bench-mt (10 threads, single logger)"
..
echo
"spdlog-bench-mt (10 threads, single logger)"
..
time
./spdlog-bench-mt
time
./spdlog-bench-mt
echo
echo
echo
echo
sleep
3
sleep
3
echo
"spdlog-bench-mt-async (10 threads, single logger)"
..
echo
"spdlog-bench-mt-async (10 threads, single logger)"
..
time
./spdlog-bench-mt-async
time
./spdlog-bench-mt-async
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment