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
e060bbf3
Commit
e060bbf3
authored
Dec 22, 2015
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
astyle
parent
a1e25cdb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
63 deletions
+63
-63
spdlog-async.cpp
bench/spdlog-async.cpp
+62
-62
format.h
include/spdlog/details/format.h
+0
-0
dist_sink.h
include/spdlog/sinks/dist_sink.h
+1
-1
No files found.
bench/spdlog-async.cpp
View file @
e060bbf3
//
// Copyright(c) 2015 Gabi Melman.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
//
#include <thread>
#include <vector>
#include <atomic>
#include <iostream>
#include <chrono>
#include <cstdlib>
#include "spdlog/spdlog.h"
using
namespace
std
;
int
main
(
int
argc
,
char
*
argv
[])
{
using
namespace
std
::
chrono
;
using
clock
=
steady_clock
;
namespace
spd
=
spdlog
;
int
thread_count
=
10
;
if
(
argc
>
1
)
thread_count
=
::
atoi
(
argv
[
1
]);
int
howmany
=
1000000
;
spd
::
set_async_mode
(
1048576
);
auto
logger
=
spdlog
::
create
<
spd
::
sinks
::
simple_file_sink_mt
>
(
"file_logger"
,
"logs/spd-bench-async.txt"
,
false
);
logger
->
set_pattern
(
"[%Y-%b-%d %T.%e]: %v"
);
std
::
atomic
<
int
>
msg_counter
{
0
};
vector
<
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 #"
<<
counter
<<
": This is some text for your pleasure"
;
}
}));
}
for
(
auto
&
t
:
threads
)
{
t
.
join
();
};
duration
<
float
>
delta
=
clock
::
now
()
-
start
;
float
deltaf
=
delta
.
count
();
auto
rate
=
howmany
/
deltaf
;
cout
<<
"Total: "
<<
howmany
<<
std
::
endl
;
cout
<<
"Threads: "
<<
thread_count
<<
std
::
endl
;
std
::
cout
<<
"Delta = "
<<
deltaf
<<
" seconds"
<<
std
::
endl
;
std
::
cout
<<
"Rate = "
<<
rate
<<
"/sec"
<<
std
::
endl
;
}
//
// Copyright(c) 2015 Gabi Melman.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
//
#include <thread>
#include <vector>
#include <atomic>
#include <iostream>
#include <chrono>
#include <cstdlib>
#include "spdlog/spdlog.h"
using
namespace
std
;
int
main
(
int
argc
,
char
*
argv
[])
{
using
namespace
std
::
chrono
;
using
clock
=
steady_clock
;
namespace
spd
=
spdlog
;
int
thread_count
=
10
;
if
(
argc
>
1
)
thread_count
=
::
atoi
(
argv
[
1
]);
int
howmany
=
1000000
;
spd
::
set_async_mode
(
1048576
);
auto
logger
=
spdlog
::
create
<
spd
::
sinks
::
simple_file_sink_mt
>
(
"file_logger"
,
"logs/spd-bench-async.txt"
,
false
);
logger
->
set_pattern
(
"[%Y-%b-%d %T.%e]: %v"
);
std
::
atomic
<
int
>
msg_counter
{
0
};
vector
<
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 #"
<<
counter
<<
": This is some text for your pleasure"
;
}
}));
}
for
(
auto
&
t
:
threads
)
{
t
.
join
();
};
duration
<
float
>
delta
=
clock
::
now
()
-
start
;
float
deltaf
=
delta
.
count
();
auto
rate
=
howmany
/
deltaf
;
cout
<<
"Total: "
<<
howmany
<<
std
::
endl
;
cout
<<
"Threads: "
<<
thread_count
<<
std
::
endl
;
std
::
cout
<<
"Delta = "
<<
deltaf
<<
" seconds"
<<
std
::
endl
;
std
::
cout
<<
"Rate = "
<<
rate
<<
"/sec"
<<
std
::
endl
;
}
include/spdlog/details/format.h
View file @
e060bbf3
This diff is collapsed.
Click to expand it.
include/spdlog/sinks/dist_sink.h
View file @
e060bbf3
//
// Copyright (c) 2015 David Schury, Gabi Melman
// Copyright (c) 2015 David Schury, Gabi Melman
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
//
...
...
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