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
31c428ce
Commit
31c428ce
authored
Jun 01, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Report memory consumption in async bench
parent
5743adc4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
8 deletions
+22
-8
bench/async_bench.cpp
bench/async_bench.cpp
+14
-5
bench/bench.cpp
bench/bench.cpp
+8
-3
No files found.
bench/async_bench.cpp
View file @
31c428ce
...
...
@@ -44,7 +44,7 @@ int main(int argc, char *argv[])
{
int
howmany
=
1000000
;
int
queue_size
=
howmany
+
2
;
int
queue_size
=
std
::
min
(
howmany
+
2
,
32768
)
;
int
threads
=
10
;
int
iters
=
3
;
...
...
@@ -62,16 +62,25 @@ int main(int argc, char *argv[])
if
(
argc
>
2
)
threads
=
atoi
(
argv
[
2
]);
if
(
argc
>
3
)
{
queue_size
=
atoi
(
argv
[
3
]);
if
(
queue_size
>
500000
)
{
spdlog
::
error
(
"Max queue size allowed: 500,000"
);
exit
(
1
);
}
}
if
(
argc
>
4
)
iters
=
atoi
(
argv
[
4
]);
auto
slot_size
=
sizeof
(
spdlog
::
details
::
async_msg
);
spdlog
::
info
(
"-------------------------------------------------"
);
spdlog
::
info
(
"Messages: {:14n}"
,
howmany
);
spdlog
::
info
(
"Threads : {:14n}"
,
threads
);
spdlog
::
info
(
"Queue : {:14n}"
,
queue_size
);
spdlog
::
info
(
"Iters : {:>14n}"
,
iters
);
spdlog
::
info
(
"Messages : {:n}"
,
howmany
);
spdlog
::
info
(
"Threads : {:n}"
,
threads
);
spdlog
::
info
(
"Queue : {:n} slots"
,
queue_size
);
spdlog
::
info
(
"Queue memory : {:n} x {} = {:n} KB "
,
queue_size
,
slot_size
,
(
queue_size
*
slot_size
)
/
1024
);
spdlog
::
info
(
"Total iters : {:n}"
,
iters
);
spdlog
::
info
(
"-------------------------------------------------"
);
const
char
*
filename
=
"logs/basic_async.log"
;
...
...
bench/bench.cpp
View file @
31c428ce
...
...
@@ -36,7 +36,7 @@ int main(int argc, char *argv[])
spdlog
::
default_logger
()
->
set_pattern
(
"[%^%l%$] %v"
);
int
howmany
=
1000000
;
int
queue_size
=
howmany
+
2
;
int
queue_size
=
819
2
;
int
threads
=
10
;
size_t
file_size
=
30
*
1024
*
1024
;
size_t
rotating_files
=
5
;
...
...
@@ -96,11 +96,16 @@ int main(int argc, char *argv[])
bench_mt
(
howmany
,
std
::
move
(
daily_mt
),
threads
);
bench_mt
(
howmany
,
spdlog
::
create
<
null_sink_mt
>
(
"null_mt"
),
threads
);
int
iters
=
3
;
spdlog
::
info
(
"**************************************************************"
);
spdlog
::
info
(
"Asyncronous.. {:n} threads sharing same logger, {:n} iterations"
,
threads
,
howmany
);
spdlog
::
info
(
"Asyncronous bench {:n} threads sharing same logger"
,
threads
);
spdlog
::
info
(
"Messages: {:n}"
,
howmany
);
spdlog
::
info
(
"Queue size: {:n} slots"
,
queue_size
);
auto
slot_size
=
sizeof
(
spdlog
::
details
::
async_msg
);
spdlog
::
info
(
"Total queue memory: {}x{} bytes per slot = {:n} Kb "
,
queue_size
,
slot_size
,
(
queue_size
*
slot_size
)
/
1024
);
spdlog
::
info
(
"**************************************************************"
);
for
(
int
i
=
0
;
i
<
3
;
++
i
)
for
(
int
i
=
0
;
i
<
iters
;
++
i
)
{
spdlog
::
init_thread_pool
(
static_cast
<
size_t
>
(
queue_size
),
1
);
auto
as
=
spdlog
::
basic_logger_mt
<
spdlog
::
async_factory
>
(
"async"
,
"logs/basic_async.log"
,
true
);
...
...
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