parse.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* cpufreq-bench CPUFreq microbenchmark
  2. *
  3. * Copyright (C) 2008 Christian Kornacker <ckornacker@suse.de>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19. /* struct that holds the required config parameters */
  20. struct config
  21. {
  22. long sleep; /* sleep time in µs */
  23. long load; /* load time in µs */
  24. long sleep_step; /* time value which changes the
  25. * sleep time after every round in µs */
  26. long load_step; /* time value which changes the
  27. * load time after every round in µs */
  28. unsigned int cycles; /* calculation cycles with the same sleep/load time */
  29. unsigned int rounds; /* calculation rounds with iterated sleep/load time */
  30. unsigned int cpu; /* cpu for which the affinity is set */
  31. char governor[15]; /* cpufreq governor */
  32. enum sched_prio /* possible scheduler priorities */
  33. {
  34. SCHED_ERR = -1,
  35. SCHED_HIGH,
  36. SCHED_DEFAULT,
  37. SCHED_LOW
  38. } prio;
  39. unsigned int verbose; /* verbose output */
  40. FILE *output; /* logfile */
  41. char *output_filename; /* logfile name, must be freed at the end
  42. if output != NULL and output != stdout*/
  43. };
  44. enum sched_prio string_to_prio(const char *str);
  45. FILE *prepare_output(const char *dir);
  46. int prepare_config(const char *path, struct config *config);
  47. struct config *prepare_default_config();