2
* @file oprof_start_config.cpp
3
* GUI startup config management
5
* @remark Copyright 2002 OProfile authors
6
* @remark Read the file COPYING
9
* @author Philippe Elie
17
#include <sys/utsname.h>
19
#include "string_manip.h"
20
#include "oprof_start_config.h"
21
#include "op_config.h"
22
#include "op_config_24.h"
26
event_setting::event_setting()
36
config_setting::config_setting()
38
buffer_size(OP_DEFAULT_BUF_SIZE),
39
note_table_size(OP_DEFAULT_NOTE_SIZE),
43
separate_kernel(false),
45
separate_thread(false),
52
/* Guess path to vmlinux based on kernel currently running. */
54
perror("oprof_start: Unable to determine OS release.");
56
string const version(info.release);
57
string const vmlinux_path("/lib/modules/" + version
59
kernel_filename = vmlinux_path;
64
void config_setting::load(istream & in)
66
buffer_size = OP_DEFAULT_BUF_SIZE;
67
note_table_size = OP_DEFAULT_NOTE_SIZE;
71
while (getline(in, str)) {
72
string val = split(str, '=');
73
if (str == "BUF_SIZE") {
74
buffer_size = op_lexical_cast<unsigned int>(val);
75
if (buffer_size < OP_DEFAULT_BUF_SIZE)
76
buffer_size = OP_DEFAULT_BUF_SIZE;
77
} else if (str == "NOTE_SIZE") {
78
note_table_size = op_lexical_cast<unsigned int>(val);
79
if (note_table_size < OP_DEFAULT_NOTE_SIZE)
80
note_table_size = OP_DEFAULT_NOTE_SIZE;
81
} else if (str == "VMLINUX") {
85
} else if (!val.empty()) {
87
kernel_filename = val;
89
} else if (str == "SEPARATE_LIB") {
90
separate_lib = op_lexical_cast<bool>(val);
91
} else if (str == "SEPARATE_KERNEL") {
92
separate_kernel = op_lexical_cast<bool>(val);
93
} else if (str == "SEPARATE_CPU") {
94
separate_cpu = op_lexical_cast<bool>(val);
95
} else if (str == "SEPARATE_THREAD") {
96
separate_thread = op_lexical_cast<bool>(val);
97
} else if (str == "CALLGRAPH") {
98
callgraph_depth = op_lexical_cast<unsigned int>(val);
99
} else if (str == "BUF_WATERSHED") {
100
buffer_watershed = op_lexical_cast<unsigned int>(val);
101
} else if (str == "CPU_BUF_SIZE") {
102
cpu_buffer_size = op_lexical_cast<unsigned int>(val);
108
istream & operator>>(istream & in, config_setting & object)