Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
da12be87
Unverified
Commit
da12be87
authored
Jun 07, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
progress_bar consuming too much time
parent
94a38ad4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
src/utilities.cpp
+8
-3
No files found.
src/utilities.cpp
View file @
da12be87
...
@@ -160,6 +160,8 @@ struct progress_bar_impl
...
@@ -160,6 +160,8 @@ struct progress_bar_impl
void
print_progress
();
void
print_progress
();
void
print_done
();
void
print_done
();
using
time_point
=
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
>
;
int64_t
m_max_value
;
int64_t
m_max_value
;
std
::
atomic
<
int64_t
>
m_consumed
;
std
::
atomic
<
int64_t
>
m_consumed
;
int64_t
m_last_consumed
=
0
;
int64_t
m_last_consumed
=
0
;
...
@@ -167,8 +169,8 @@ struct progress_bar_impl
...
@@ -167,8 +169,8 @@ struct progress_bar_impl
std
::
string
m_action
,
m_message
;
std
::
string
m_action
,
m_message
;
std
::
mutex
m_mutex
;
std
::
mutex
m_mutex
;
std
::
thread
m_thread
;
std
::
thread
m_thread
;
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
>
time_point
m_start
=
std
::
chrono
::
system_clock
::
now
();
m_star
t
=
std
::
chrono
::
system_clock
::
now
();
time_point
m_las
t
=
std
::
chrono
::
system_clock
::
now
();
bool
m_stop
=
false
;
bool
m_stop
=
false
;
};
};
...
@@ -191,7 +193,9 @@ void progress_bar_impl::run()
...
@@ -191,7 +193,9 @@ void progress_bar_impl::run()
{
{
while
(
not
m_stop
)
while
(
not
m_stop
)
{
{
if
(
std
::
chrono
::
system_clock
::
now
()
-
m_start
<
2
s
)
auto
now
=
std
::
chrono
::
system_clock
::
now
();
if
(
now
-
m_start
<
2
s
or
now
-
m_last
<
100
ms
)
{
{
std
::
this_thread
::
sleep_for
(
10
ms
);
std
::
this_thread
::
sleep_for
(
10
ms
);
continue
;
continue
;
...
@@ -205,6 +209,7 @@ void progress_bar_impl::run()
...
@@ -205,6 +209,7 @@ void progress_bar_impl::run()
print_progress
();
print_progress
();
printedAny
=
true
;
printedAny
=
true
;
m_last
=
std
::
chrono
::
system_clock
::
now
();
}
}
}
}
catch
(...)
catch
(...)
...
...
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