|
|
05a5b2 |
diff -up oprofile-0.9.9/libpp/profile_spec.cpp.archive oprofile-0.9.9/libpp/profile_spec.cpp
|
|
|
05a5b2 |
--- oprofile-0.9.9/libpp/profile_spec.cpp.archive 2013-07-29 11:55:06.000000000 -0400
|
|
|
05a5b2 |
+++ oprofile-0.9.9/libpp/profile_spec.cpp 2016-07-06 11:20:55.076624764 -0400
|
|
|
05a5b2 |
@@ -102,6 +102,8 @@ void profile_spec::set_image_or_lib_name
|
|
|
05a5b2 |
void profile_spec::parse_archive_path(string const & str)
|
|
|
05a5b2 |
{
|
|
|
05a5b2 |
archive_path = op_realpath(str);
|
|
|
05a5b2 |
+ /* Need to force session directory default location in the archive */
|
|
|
05a5b2 |
+ init_op_config_dirs(OP_SESSION_DIR_DEFAULT);
|
|
|
05a5b2 |
}
|
|
|
05a5b2 |
|
|
|
05a5b2 |
|
|
|
05a5b2 |
diff -up oprofile-0.9.9/pp/oparchive.cpp.archive oprofile-0.9.9/pp/oparchive.cpp
|
|
|
05a5b2 |
--- oprofile-0.9.9/pp/oparchive.cpp.archive 2013-07-29 11:55:06.000000000 -0400
|
|
|
05a5b2 |
+++ oprofile-0.9.9/pp/oparchive.cpp 2016-07-06 11:20:55.076624764 -0400
|
|
|
05a5b2 |
@@ -232,6 +232,19 @@ int oparchive(options::spec const & spec
|
|
|
05a5b2 |
}
|
|
|
05a5b2 |
}
|
|
|
05a5b2 |
|
|
|
05a5b2 |
+ /* place samples and other related material in easily found default directory */
|
|
|
05a5b2 |
+ string dest_session_dir = options::outdirectory + string(OP_SESSION_DIR_DEFAULT);
|
|
|
05a5b2 |
+ string dest_samples_dir = dest_session_dir + string("samples");
|
|
|
05a5b2 |
+
|
|
|
05a5b2 |
+ /* dest_session_dir is parent of dest_samples and will also created */
|
|
|
05a5b2 |
+
|
|
|
05a5b2 |
+ if (!options::list_files &&
|
|
|
05a5b2 |
+ create_path(dest_samples_dir.c_str())) {
|
|
|
05a5b2 |
+ cerr << "Unable to create directory for "
|
|
|
05a5b2 |
+ << dest_samples_dir << "." << endl;
|
|
|
05a5b2 |
+ exit (EXIT_FAILURE);
|
|
|
05a5b2 |
+ }
|
|
|
05a5b2 |
+
|
|
|
05a5b2 |
/* copy over each of the sample files */
|
|
|
05a5b2 |
list<string>::iterator sit = sample_files.begin();
|
|
|
05a5b2 |
list<string>::iterator const send = sample_files.end();
|
|
|
05a5b2 |
@@ -245,9 +258,13 @@ int oparchive(options::spec const & spec
|
|
|
05a5b2 |
|
|
|
05a5b2 |
for (; sit != send; ++sit) {
|
|
|
05a5b2 |
string sample_name = *sit;
|
|
|
05a5b2 |
+ /* determine the session name of sample file */
|
|
|
05a5b2 |
+ int offset = sample_name.find('{');
|
|
|
05a5b2 |
+ string base_samples_dir = sample_name.substr(0, offset-1);
|
|
|
05a5b2 |
+ string session = basename(base_samples_dir.c_str());
|
|
|
05a5b2 |
/* Get rid of the the archive_path from the name */
|
|
|
05a5b2 |
- string sample_base = sample_name.substr(archive_path.size());
|
|
|
05a5b2 |
- string sample_archive_file = options::outdirectory + sample_base;
|
|
|
05a5b2 |
+ string sample_base = sample_name.substr(offset);
|
|
|
05a5b2 |
+ string sample_archive_file = dest_samples_dir + "/" + session + "/" + sample_base;
|
|
|
05a5b2 |
|
|
|
05a5b2 |
cverb << vdebug << sample_name << endl;
|
|
|
05a5b2 |
cverb << vdebug << " destp " << sample_archive_file << endl;
|
|
|
05a5b2 |
@@ -268,19 +285,19 @@ int oparchive(options::spec const & spec
|
|
|
05a5b2 |
cerr << "Unable to to obtain realpath for " << op_session_dir << endl;
|
|
|
05a5b2 |
exit (EXIT_FAILURE);
|
|
|
05a5b2 |
}
|
|
|
05a5b2 |
- string abi_name = string(real_session_dir) + "/abi";
|
|
|
05a5b2 |
- copy_one_file(image_ok, archive_path + abi_name,
|
|
|
05a5b2 |
- options::outdirectory + abi_name);
|
|
|
05a5b2 |
+ string abi_name = string(real_session_dir) + string("/abi");
|
|
|
05a5b2 |
+ string dest_abi_name = dest_session_dir + string("/abi");
|
|
|
05a5b2 |
+ copy_one_file(image_ok, archive_path + abi_name, dest_abi_name);
|
|
|
05a5b2 |
|
|
|
05a5b2 |
/* copy over the <session-dir>/samples/oprofiled.log file */
|
|
|
05a5b2 |
- string log_name = string(real_session_dir) + string("/samples") + "/oprofiled.log";
|
|
|
05a5b2 |
- copy_one_file(image_ok, archive_path + log_name,
|
|
|
05a5b2 |
- options::outdirectory + log_name);
|
|
|
05a5b2 |
+ string log_name = string(real_session_dir) + string("/samples") + string("/oprofiled.log");
|
|
|
05a5b2 |
+ string dest_log_name = dest_samples_dir + string("/oprofiled.log");
|
|
|
05a5b2 |
+ copy_one_file(image_ok, archive_path + log_name, dest_log_name);
|
|
|
05a5b2 |
|
|
|
05a5b2 |
/* copy over the <session-dir>/samples/operf.log file */
|
|
|
05a5b2 |
- log_name = string(real_session_dir) + string("/samples") + "/operf.log";
|
|
|
05a5b2 |
- copy_one_file(image_ok, archive_path + log_name,
|
|
|
05a5b2 |
- options::outdirectory + log_name);
|
|
|
05a5b2 |
+ log_name = string(real_session_dir) + string("/samples") + string("/operf.log");
|
|
|
05a5b2 |
+ dest_log_name = dest_samples_dir + string("/operf.log");
|
|
|
05a5b2 |
+ copy_one_file(image_ok, archive_path + log_name, dest_log_name);
|
|
|
05a5b2 |
|
|
|
05a5b2 |
free(real_session_dir);
|
|
|
05a5b2 |
|
|
|
05a5b2 |
diff -up oprofile-0.9.9/pp/oparchive_options.cpp.archive oprofile-0.9.9/pp/oparchive_options.cpp
|
|
|
05a5b2 |
--- oprofile-0.9.9/pp/oparchive_options.cpp.archive 2016-07-06 11:20:55.077624764 -0400
|
|
|
05a5b2 |
+++ oprofile-0.9.9/pp/oparchive_options.cpp 2016-07-06 11:26:13.968624764 -0400
|
|
|
05a5b2 |
@@ -124,7 +124,6 @@ void handle_options(options::spec const
|
|
|
05a5b2 |
|
|
|
05a5b2 |
if (strncmp(op_session_dir, "/var/lib/oprofile", strlen("/var/lib/oprofile")))
|
|
|
05a5b2 |
cerr << "NOTE: The sample data in this archive is located at " << op_session_dir << endl
|
|
|
05a5b2 |
- << "instead of the standard location of /var/lib/oprofile. Hence, when using opreport" << endl
|
|
|
05a5b2 |
- << "and other post-processing tools on this archive, you must pass the following option:" << endl
|
|
|
05a5b2 |
- << "\t--session-dir=" << op_session_dir << endl;
|
|
|
05a5b2 |
+ << "and is being moved to the standard location of " << OP_SESSION_DIR_DEFAULT << "."
|
|
|
05a5b2 |
+ << endl;
|
|
|
05a5b2 |
}
|