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
40143cae
Commit
40143cae
authored
Oct 16, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
async-bech to use spdlog for output
parent
b1277cae
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
bench/async_bench.cpp
bench/async_bench.cpp
+11
-12
No files found.
bench/async_bench.cpp
View file @
40143cae
...
@@ -50,11 +50,10 @@ int main(int argc, char *argv[])
...
@@ -50,11 +50,10 @@ int main(int argc, char *argv[])
try
try
{
{
auto
console
=
spdlog
::
stdout_color_mt
(
"console"
);
if
(
argc
==
1
)
if
(
argc
==
1
)
{
{
console
->
set_pattern
(
"%v"
);
spdlog
::
set_pattern
(
"%v"
);
console
->
info
(
"Usage: {} <message_count> <threads> <q_size> <iterations>"
,
argv
[
0
]);
spdlog
::
info
(
"Usage: {} <message_count> <threads> <q_size> <iterations>"
,
argv
[
0
]);
return
0
;
return
0
;
}
}
...
@@ -68,12 +67,12 @@ int main(int argc, char *argv[])
...
@@ -68,12 +67,12 @@ int main(int argc, char *argv[])
if
(
argc
>
4
)
if
(
argc
>
4
)
iters
=
atoi
(
argv
[
4
]);
iters
=
atoi
(
argv
[
4
]);
console
->
info
(
"-------------------------------------------------"
);
spdlog
::
info
(
"-------------------------------------------------"
);
console
->
info
(
"Messages: {:14n}"
,
howmany
);
spdlog
::
info
(
"Messages: {:14n}"
,
howmany
);
console
->
info
(
"Threads : {:14n}"
,
threads
);
spdlog
::
info
(
"Threads : {:14n}"
,
threads
);
console
->
info
(
"Queue : {:14n}"
,
queue_size
);
spdlog
::
info
(
"Queue : {:14n}"
,
queue_size
);
console
->
info
(
"Iters : {:>14n}"
,
iters
);
spdlog
::
info
(
"Iters : {:>14n}"
,
iters
);
console
->
info
(
"-------------------------------------------------"
);
spdlog
::
info
(
"-------------------------------------------------"
);
const
char
*
filename
=
"logs/basic_async.log"
;
const
char
*
filename
=
"logs/basic_async.log"
;
...
@@ -87,12 +86,12 @@ int main(int argc, char *argv[])
...
@@ -87,12 +86,12 @@ int main(int argc, char *argv[])
if
(
count
!=
howmany
)
if
(
count
!=
howmany
)
{
{
console
->
error
(
"Test failed. {} has {:n} lines instead of {:n}"
,
filename
,
count
,
howmany
);
spdlog
::
error
(
"Test failed. {} has {:n} lines instead of {:n}"
,
filename
,
count
,
howmany
);
exit
(
1
);
exit
(
1
);
}
}
else
else
{
{
console
->
info
(
"Line count OK ({:n})
\n
"
,
count
);
spdlog
::
info
(
"Line count OK ({:n})
\n
"
,
count
);
}
}
}
}
}
}
...
@@ -136,5 +135,5 @@ void bench_mt(int howmany, std::shared_ptr<spdlog::logger> logger, int thread_co
...
@@ -136,5 +135,5 @@ void bench_mt(int howmany, std::shared_ptr<spdlog::logger> logger, int thread_co
auto
delta
=
high_resolution_clock
::
now
()
-
start
;
auto
delta
=
high_resolution_clock
::
now
()
-
start
;
auto
delta_d
=
duration_cast
<
duration
<
double
>>
(
delta
).
count
();
auto
delta_d
=
duration_cast
<
duration
<
double
>>
(
delta
).
count
();
spdlog
::
get
(
"console"
)
->
info
(
"Elapsed: {} secs
\t
{:n}/sec"
,
delta_d
,
int
(
howmany
/
delta_d
));
spdlog
::
info
(
"Elapsed: {} secs
\t
{:n}/sec"
,
delta_d
,
int
(
howmany
/
delta_d
));
}
}
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