diff options
author | Nick Foster <nick@ettus.com> | 2011-05-12 15:39:56 -0700 |
---|---|---|
committer | Nick Foster <nick@ettus.com> | 2011-05-12 15:39:56 -0700 |
commit | b0e781a55387e02ef8126219ccfe8b3c48a838f5 (patch) | |
tree | 1cbd92aff7e2af8be91571f5f9273f600cdee7d0 /volk/apps | |
parent | 256304ee92f49b536358252693a2083f211e1e37 (diff) |
Volk: move configuration into ~/.volk instead of ~/.gnuradio, add ability to create dir in profiler if not exist
Diffstat (limited to 'volk/apps')
-rw-r--r-- | volk/apps/volk_profile.cc | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/volk/apps/volk_profile.cc b/volk/apps/volk_profile.cc index 49e6db3fca..3fe227400d 100644 --- a/volk/apps/volk_profile.cc +++ b/volk/apps/volk_profile.cc @@ -7,14 +7,13 @@ extern "C" { #include <boost/foreach.hpp> #include <iostream> #include <fstream> +#include <sys/stat.h> +#include <sys/types.h> int main(int argc, char *argv[]) { - std::vector<std::string> results; - char path[256]; - get_config_path(path); - std::string config_path(path); - + std::vector<std::string> results; +/* //VOLK_PROFILE(volk_16i_x5_add_quad_16i_x4_a16, 1e-4, 2046, 10000, &results); //VOLK_PROFILE(volk_16i_branch_4_state_8_a16, 1e-4, 2046, 10000, &results); VOLK_PROFILE(volk_16ic_s32f_deinterleave_real_32f_a16, 1e-5, 32768.0, 204600, 10000, &results); @@ -101,12 +100,29 @@ int main(int argc, char *argv[]) { VOLK_PROFILE(volk_8ic_x2_s32f_multiply_conjugate_32fc_a16, 1e-4, 100, 204600, 400, &results); VOLK_PROFILE(volk_8i_convert_16i_a16, 0, 0, 204600, 20000, &results); VOLK_PROFILE(volk_8i_convert_16i_u, 0, 0, 204600, 2000, &results); + */ VOLK_PROFILE(volk_8i_s32f_convert_32f_a16, 1e-4, 100, 204600, 2000, &results); VOLK_PROFILE(volk_8i_s32f_convert_32f_u, 1e-4, 100, 204600, 2000, &results); + char path[256]; + get_config_path(path); + std::string config_path(path); std::ofstream config; std::cout << "filename: " << config_path << std::endl; config.open(config_path.c_str()); + if(!config.is_open()) { //either we don't have write access or we don't have the dir yet + std::string dir(getenv("HOME")); + dir += "/.volk"; + if(mkdir(dir.c_str(), 0777) == -1) { + std::cout << "Error creating directory " << dir << std::endl; + return -1; + } + config.open(config_path.c_str()); + if(!config.is_open()) { + std::cout << "Error opening file " << config_path << std::endl; + return -1; + } + } config << "\ #this file is generated by volk_profile.\n\ |