2012/4/22 Németh Márton <nm...@freemail.hu>: > Thomas Spura wrote: >> 2012/4/21 Németh Márton <nm...@freemail.hu>: >>> diff --git a/main.cpp b/main.cpp >>> index 0e57ee1..67db2eb 100644 >>> --- a/main.cpp >>> +++ b/main.cpp >>> @@ -240,6 +240,7 @@ void report(int time, int iterations, char *file) >>> one_measurement(time); >>> report_show_tunables(); >>> finish_report_output(); >>> + clear_tuning(); >>> } >>> /* and wrap up */ >>> learn_parameters(50, 0); >>> @@ -415,6 +416,7 @@ int main(int argc, char **argv) >>> learn_parameters(500, 0); >>> save_parameters("saved_parameters.powertop"); >>> end_pci_access(); >>> + clear_tuning(); >>> reset_display(); >>> >>> clear_all_devices(); >> >> These two chunks don't apply here. Did you create the patch against >> currend HEAD commit 1dfdb80d? But look fine, when applying manually. > > Yes, I used 1dfdb80d revision as a base. I don't know what could have went > wrong.
Could also be my fault, as I'm pretty new to the mailinglist workflow. (Previously, I only did github pull requests etc). >>> diff --git a/tuning/tuning.cpp b/tuning/tuning.cpp >>> index a0c3ffa..6a359ae 100644 >>> --- a/tuning/tuning.cpp >>> +++ b/tuning/tuning.cpp >>> @@ -312,3 +312,15 @@ void report_show_tunables(void) >>> fprintf(reportout.csv_report,"\n"); >>> } >>> } >>> + >>> +void clear_tuning() >>> +{ >>> + while (!all_tunables.empty()) { >>> + delete all_tunables.back(); >>> + all_tunables.pop_back(); >>> + } >>> + while (!all_untunables.empty()) { >>> + delete all_untunables.back(); >>> + all_untunables.pop_back(); >>> + } >>> +} >> >> I'd prefer a for loop like in commit 1dfdb80d. Easier to read and >> should be faster than poping and always check for empty(). > > Are you speaking about this commit? Same commit id as above... Copy&paste error... I was talking about commit 47cfb71 and e08a9c5, e.g.: +void clear_all_devices(void) +{ + for (int i = 0; i < all_devices.size(); i++) { + delete all_devices[i]; + } + all_devices.clear(); +} Here anything is deleted in order and all_devices is resized once (and not .size() times like in the tunables case). Greetings, Tom _______________________________________________ Power mailing list Power@bughost.org https://bughost.org/mailman/listinfo/power