Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
b7cd5020
Commit
b7cd5020
authored
Oct 12, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed redundant file
parent
53ac379b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
77 deletions
+0
-77
bench/spdlog-async.cpp
bench/spdlog-async.cpp
+0
-77
include/spdlog/default_logger.h
include/spdlog/default_logger.h
+0
-0
No files found.
bench/spdlog-async.cpp
deleted
100644 → 0
View file @
53ac379b
//
// Copyright(c) 2015 Gabi Melman.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
//
#include <atomic>
#include <chrono>
#include <cstdlib>
#include <iostream>
#include <thread>
#include <vector>
#include "spdlog/async.h"
#include "spdlog/sinks/basic_file_sink.h"
using
namespace
std
;
int
main
(
int
argc
,
char
*
argv
[])
{
using
namespace
std
::
chrono
;
using
clock
=
steady_clock
;
int
thread_count
=
10
;
if
(
argc
>
1
)
thread_count
=
std
::
atoi
(
argv
[
1
]);
int
howmany
=
1000000
;
spdlog
::
init_thread_pool
(
howmany
,
1
);
auto
logger
=
spdlog
::
create_async_logger
<
spdlog
::
sinks
::
basic_file_sink_mt
>
(
"file_logger"
,
"logs/spdlog-bench-async.log"
,
false
);
logger
->
set_pattern
(
"[%Y-%m-%d %T.%F]: %L %t %v"
);
std
::
cout
<<
"To stop, press <Enter>"
<<
std
::
endl
;
std
::
atomic
<
bool
>
run
{
true
};
std
::
thread
stoper
(
std
::
thread
([
&
run
]()
{
std
::
cin
.
get
();
run
=
false
;
}));
while
(
run
)
{
std
::
atomic
<
int
>
msg_counter
{
0
};
std
::
vector
<
std
::
thread
>
threads
;
auto
start
=
clock
::
now
();
for
(
int
t
=
0
;
t
<
thread_count
;
++
t
)
{
threads
.
push_back
(
std
::
thread
([
&
]()
{
while
(
true
)
{
int
counter
=
++
msg_counter
;
if
(
counter
>
howmany
)
break
;
logger
->
info
(
"spdlog message #{}: This is some text for your pleasure"
,
counter
);
}
}));
}
for
(
auto
&
t
:
threads
)
{
t
.
join
();
}
duration
<
float
>
delta
=
clock
::
now
()
-
start
;
float
deltaf
=
delta
.
count
();
auto
rate
=
howmany
/
deltaf
;
std
::
cout
<<
"Total: "
<<
howmany
<<
std
::
endl
;
std
::
cout
<<
"Threads: "
<<
thread_count
<<
std
::
endl
;
std
::
cout
<<
"Delta = "
<<
std
::
fixed
<<
deltaf
<<
" seconds"
<<
std
::
endl
;
std
::
cout
<<
"Rate = "
<<
std
::
fixed
<<
rate
<<
"/sec"
<<
std
::
endl
;
}
// while
stoper
.
join
();
return
0
;
}
include/spdlog/default_logger.h
0 → 100644
View file @
b7cd5020
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