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
535e332d
Commit
535e332d
authored
Oct 10, 2014
by
gabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added
parent
8fbade29
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
bench.cpp
example/bench.cpp
+49
-0
No files found.
example/bench.cpp
0 → 100644
View file @
535e332d
// example.cpp : Simple logger example
//
#include <mutex>
#include "c11log/logger.h"
#include "c11log/sinks/async_sink.h"
#include "c11log/sinks/file_sinks.h"
#include "c11log/sinks/stdout_sinks.h"
#include "c11log/sinks/null_sink.h"
#include "utils.h"
using
std
::
cout
;
using
std
::
endl
;
using
namespace
std
::
chrono
;
using
namespace
c11log
;
using
namespace
utils
;
int
main
(
int
argc
,
char
*
argv
[])
{
const
unsigned
int
howmany
=
argc
<=
1
?
10000
:
atoi
(
argv
[
1
]);
logger
cout_logger
(
"example"
,
std
::
make_shared
<
sinks
::
stderr_sink_mt
>
());
cout_logger
.
info
()
<<
"Hello logger"
;
//auto nullsink = std::make_shared<sinks::null_sink<std::mutex>>();
auto
nullsink
=
std
::
make_shared
<
sinks
::
null_sink
<
details
::
null_mutex
>>
();
auto
fsink
=
std
::
make_shared
<
sinks
::
rotating_file_sink_st
>
(
"log"
,
"txt"
,
1024
*
1024
*
50
,
5
,
10
);
auto
as
=
std
::
make_shared
<
sinks
::
async_sink
>
(
1000
);
logger
my_logger
(
"my_logger"
,
fsink
);
auto
start
=
system_clock
::
now
();
for
(
unsigned
int
i
=
1
;
i
<=
howmany
;
++
i
)
my_logger
.
info
()
<<
"Hello logger: msg #"
<<
i
;
auto
delta
=
system_clock
::
now
()
-
start
;
auto
delta_d
=
duration_cast
<
duration
<
double
>>
(
delta
).
count
();
cout
<<
"Total:"
<<
format
(
howmany
)
<<
endl
;
cout
<<
"Delta:"
<<
format
(
delta_d
)
<<
endl
;
cout
<<
"Rate:"
<<
format
(
howmany
/
delta_d
)
<<
"/sec"
<<
endl
;
return
0
;
}
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