powertop-2.7-always-create-params.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. diff --git a/src/parameters/persistent.cpp b/src/parameters/persistent.cpp
  2. index 9a5688a..6a232cd 100644
  3. --- a/src/parameters/persistent.cpp
  4. +++ b/src/parameters/persistent.cpp
  5. @@ -145,9 +145,6 @@ void save_parameters(const char *filename)
  6. // printf("result size is %i, #parameters is %i \n", (int)past_results.size(), (int)all_parameters.parameters.size());
  7. - if (!global_power_valid())
  8. - return;
  9. -
  10. pathname = get_param_directory(filename);
  11. file.open(pathname, ios::out);
  12. @@ -156,12 +153,15 @@ void save_parameters(const char *filename)
  13. return;
  14. }
  15. - map<string, int>::iterator it;
  16. + if (global_power_valid())
  17. + {
  18. + map<string, int>::iterator it;
  19. - for (it = param_index.begin(); it != param_index.end(); it++) {
  20. - int index;
  21. - index = it->second;
  22. - file << it->first << "\t" << setprecision(9) << all_parameters.parameters[index] << "\n";
  23. + for (it = param_index.begin(); it != param_index.end(); it++) {
  24. + int index;
  25. + index = it->second;
  26. + file << it->first << "\t" << setprecision(9) << all_parameters.parameters[index] << "\n";
  27. + }
  28. }
  29. file.close();
  30. }