Upstream | cc2ee17 | 1970-01-12 13:46:40 +0000 | [diff] [blame^] | 1 | /** |
| 2 | * @file oprof_start_util.h |
| 3 | * Miscellaneous helpers for the GUI start |
| 4 | * |
| 5 | * @remark Copyright 2002 OProfile authors |
| 6 | * @remark Read the file COPYING |
| 7 | * |
| 8 | * @author Philippe Elie |
| 9 | * @author John Levon |
| 10 | */ |
| 11 | |
| 12 | #ifndef OPROF_START_UTIL_H |
| 13 | #define OPROF_START_UTIL_H |
| 14 | |
| 15 | #include <cmath> |
| 16 | #include <string> |
| 17 | #include <vector> |
| 18 | |
| 19 | /// Store various daemon status data |
| 20 | struct daemon_status { |
| 21 | /// fill various data member according to the current daemon status |
| 22 | daemon_status(); |
| 23 | bool running; ///< true if daemon is running |
| 24 | unsigned int nr_interrupts; ///< nr_interrupts from profiling start |
| 25 | }; |
| 26 | |
| 27 | inline double ratio(double x1, double x2) |
| 28 | { |
| 29 | return fabs(((x1 - x2) / x2)) * 100; |
| 30 | } |
| 31 | |
| 32 | std::string const get_user_filename(std::string const & filename); |
| 33 | bool check_and_create_config_dir(); |
| 34 | std::string const format(std::string const & orig, uint const maxlen); |
| 35 | int do_exec_command(std::string const & cmd, std::vector<std::string> const & args = std::vector<std::string>()); |
| 36 | std::string const do_open_file_or_dir(std::string const & base_dir, bool dir_only); |
| 37 | bool verify_argument(std::string const & str); |
| 38 | |
| 39 | #endif // OPROF_START_UTIL_H |