Skip to content

Commit

Permalink
Progress refreshes too often - every fews seconds should be OK
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewWPhillips committed Aug 11, 2016
1 parent c5ca45d commit cb75d07
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions HexEdit/DataFormatView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1195,8 +1195,8 @@ void CDataFormatView::InitTree()
#endif
}

// Update scan progress no more than once a second
if (double(clock() - last_checked)/CLOCKS_PER_SEC > 1)
// Update scan progress no more than once every 5 seconds
if (double(clock() - last_checked)/CLOCKS_PER_SEC > 5)
{
mm->Progress(int((ii*100)/pdoc->df_type_.size()));
last_checked = clock();
Expand Down
12 changes: 6 additions & 6 deletions HexEdit/Docdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ void CHexEditDoc::WriteInPlace()

// Update progress
total_done += count;
if ((clock() - last_checked)/CLOCKS_PER_SEC > 1)
if ((clock() - last_checked)/CLOCKS_PER_SEC > 2)
{
mm->m_wndStatusBar.SetPaneProgress(0, long(total_done*100/total_todo));
last_checked = clock();
Expand Down Expand Up @@ -989,7 +989,7 @@ void CHexEditDoc::WriteInPlace()

// Update progress
total_done += count;
if ((clock() - last_checked)/CLOCKS_PER_SEC > 1)
if ((clock() - last_checked)/CLOCKS_PER_SEC > 2)
{
mm->m_wndStatusBar.SetPaneProgress(0, long(total_done*100/total_todo));
last_checked = clock();
Expand All @@ -1012,7 +1012,7 @@ void CHexEditDoc::WriteInPlace()
#ifdef INPLACE_MOVE
// Update progress bar
total_done += (pl->dlen&doc_loc::mask);
if ((clock() - last_checked)/CLOCKS_PER_SEC > 1)
if ((clock() - last_checked)/CLOCKS_PER_SEC > 2)
{
mm->m_wndStatusBar.SetPaneProgress(0, long(total_done*100/total_todo));
last_checked = clock();
Expand Down Expand Up @@ -1043,7 +1043,7 @@ void CHexEditDoc::WriteInPlace()
#ifdef INPLACE_MOVE
// Update progress bar
total_done += tocopy;
if ((clock() - last_checked)/CLOCKS_PER_SEC > 1)
if ((clock() - last_checked)/CLOCKS_PER_SEC > 2)
{
mm->m_wndStatusBar.SetPaneProgress(0, long(total_done*100/total_todo));
last_checked = clock();
Expand Down Expand Up @@ -1172,8 +1172,8 @@ BOOL CHexEditDoc::WriteData(const CString filename, FILE_ADDRESS start, FILE_ADD
ASSERT(got > 0);

ff.Write(buf, got);
// Update scan progress no more than once every 1 seconds
if ((clock() - last_checked)/CLOCKS_PER_SEC > 1)
// Update save progress no more than once every 5 seconds
if ((clock() - last_checked)/CLOCKS_PER_SEC > 5)
{
mm->m_wndStatusBar.SetPaneProgress(0, long(((address-start)*98)/(end-start) + 1));
last_checked = clock();
Expand Down
4 changes: 2 additions & 2 deletions HexEdit/Template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1895,8 +1895,8 @@ int CHexEditDoc::add_branch(CXmlTree::CElt parent, FILE_ADDRESS addr, unsigned c
df_info_.pop_back();
}

// Update scan progress no more than once a second
if (length_ > 0 && addr > 0 && (clock() - m_last_checked)/CLOCKS_PER_SEC > 1 && !in_jump_)
// Update scan progress no more than once every 5 seconds
if (length_ > 0 && addr > 0 && (clock() - m_last_checked)/CLOCKS_PER_SEC > 5 && !in_jump_)
{
((CMainFrame *)AfxGetMainWnd())->Progress(addr < length_ ? int((addr*100)/length_) : 100);
m_last_checked = clock();
Expand Down

0 comments on commit cb75d07

Please sign in to comment.