Bugzilla – Attachment 486230 Details for
Bug 756493
Yast2 System Backup causes Xorg to use much CPU
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
Proposed patch
yast-backup.diff (text/plain), 5.18 KB, created by
Lukas Ocilka
on 2012-04-16 10:56:27 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Lukas Ocilka
Created:
2012-04-16 10:56:27 UTC
Size:
5.18 KB
patch
obsolete
>Index: ui.ycp >=================================================================== >--- ui.ycp (revision 67933) >+++ ui.ycp (working copy) >@@ -1768,9 +1768,32 @@ > } > } > >+integer ui_last_refresh = 0; >+integer ui_time_now = 0; >+ > /** >- * not sure >+ * Updates UI: Modified files size and count > */ >+define void Search_UpdateFilesAndSize (integer & modified_size, integer & modified_num) { >+ # There's no UI in cron mode >+ if (Backup::cron_mode) >+ return; >+ >+ ui_time_now = time(); >+ >+ if (ui_time_now > ui_last_refresh) { >+ ui_last_refresh = ui_time_now; >+ >+ UI::ChangeWidget(`id(`totsize), `Value, >+ _("Total Size: ") + String::FormatSize (modified_size)); >+ UI::ChangeWidget(`id(`numfiles), `Value, >+ _("Modified Files: ") + sformat ("%1", modified_num)); >+ } >+} >+ >+/** >+ * Updates UI while searching for modified files >+ */ > define void Search_ModifiedFiles () { > line = substring(line, size(id_file)); > >@@ -1778,11 +1801,7 @@ > modified_size = modified_size + tointeger(size_str); > modified_num = modified_num + 1; > >- if (!Backup::cron_mode) >- { >- UI::ChangeWidget(`id(`totsize), `Value, _("Total Size: ") + sformat("%1", String::FormatSize(modified_size))); >- UI::ChangeWidget(`id(`numfiles), `Value, _("Modified Files: ") + sformat("%1", modified_num)); >- } >+ Search_UpdateFilesAndSize(modified_size, modified_num); > > string found_file = substring(line, findfirstof(line, " ") + 1); > >@@ -1837,7 +1856,7 @@ > reading_installed_packages = true; > } else { > if (line == id_files_read) { >- if (Backup::cron_mode != true) { >+ if (!Backup::cron_mode) { > SetDialogContents_SearchingForModifiedFiles(total_packages); > UI::RecalcLayout(); > } >@@ -2019,6 +2038,27 @@ > return `next; > } > >+integer dir_last_refresh = 0; >+integer dir_time_now = 0; >+string dir_shown = ""; >+ >+define void Search_ShowCurrentDir (string & actual_dir) { >+ // No update >+ if (dir_shown == actual_dir) >+ return; >+ >+ dir_time_now = time(); >+ >+ if (dir_time_now > dir_last_refresh) { >+ UI::ChangeWidget(`id(`directory), `Value, _("Searching in Directory: ") + actual_dir); >+ dir_last_refresh = dir_time_now; >+ dir_shown = actual_dir; >+ >+ // BNC#172406: Cannot be used for ncurses >+ if (!in_ncurses) UI::RecalcLayout(); >+ } >+} >+ > /** > * Display progress of searching modified files in packages > * @return symbol Symbol for wizard sequencer - pressed button >@@ -2072,6 +2112,7 @@ > Search_ChangedPackageFiles(); > } else { > if (substring(line, 0, size(id_file)) == id_file) { >+ ui_last_refresh = 0; > Search_ModifiedFiles(); > } else { > if (line == id_nopackage) { >@@ -2123,19 +2164,27 @@ > // searching files not belonging to any package > if (search_no_package) { > string actual_dir = "/"; >+ >+ # Strings are not localized on purpose: Used for matching output from >+ # the searching script > string id_readingall = "Reading all files"; > string id_readall = "Files read"; > string id_dir = "Dir: "; > >+ # Chached value >+ integer size_id_dir = size(id_dir); >+ > if (!Backup::cron_mode) { > SetDialogContents_SearchingFiles(); > } > >- integer dircount = 0; >+ ui_last_refresh = 0; > > list package_files_part = []; > integer new_files = 0; > >+ string dir_shown = ""; >+ > while ((boolean) SCR::Read (.process.running, backup_PID) || ! (boolean) SCR::Read (.process.buffer_empty, backup_PID)) > // test of script_out size is needed, because previous while cycle was interrupted and script could exited with no new output... > { >@@ -2156,12 +2205,7 @@ > > nopkg_num = nopkg_num + 1; > >- // refresh status when 10 new files was found - it's faster... >- if (nopkg_num % 10 == 0 && Backup::cron_mode != true) >- { >- UI::ChangeWidget(`id(`totsize), `Value, _("Total Size: ") + String::FormatSize(nopkg_size)); >- UI::ChangeWidget(`id(`numfiles), `Value, _("Modified Files: ") + sformat("%1", nopkg_num)); >- } >+ Search_UpdateFilesAndSize(modified_size, modified_num); > > string found_file = substring(line, findfirstof(line, " ") + 1); > >@@ -2179,35 +2223,20 @@ > new_files = new_files + 1; > > // merge more files in one step - it's faster >- if (new_files == 1000) >- { >+ if (new_files == 1000) { > package_files = merge(package_files, package_files_part); > package_files_part = []; > new_files = 0; > } >- } >- else >- { >- if (substring(line, 0, size(id_dir)) == id_dir) >- { >- dircount = dircount + 1; >- >- if (dircount == 5) >- { >- actual_dir = substring(line, size(id_dir)); >- >- if (!Backup::cron_mode) >- { >- UI::ChangeWidget(`id(`directory), `Value, _("Searching in Directory: ") + actual_dir); >- // bug #172406 >- // Cannot be used for ncurses >- if (!in_ncurses) UI::RecalcLayout(); >- } >- >- dircount = 0; >+ } else { >+ if (!Backup::cron_mode) { >+ if (substring (line, 0, size_id_dir) == id_dir) { >+ actual_dir = substring(line, size_id_dir); > } > } > } >+ >+ Search_ShowCurrentDir (actual_dir); > // <--- > > script_out = [];
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 756493
:
485688
| 486230 |
486423
|
489391