diff options
author | Tom Rondeau | 2013-02-21 20:02:05 -0500 |
---|---|---|
committer | Tom Rondeau | 2013-02-21 20:02:05 -0500 |
commit | 96583a9009478242c51ecfd7bb4321ed3d90e3b8 (patch) | |
tree | 95f5b6fc4f8a43aaacda67ff1d700b33516b388f /volk/apps/volk_profile.cc | |
parent | 2fcf27f95b10d84dbe0e2b36a316c6ed87dc8739 (diff) | |
parent | e7e219cde48347fbaf8849fcb820212893272a2e (diff) | |
download | gnuradio-96583a9009478242c51ecfd7bb4321ed3d90e3b8.tar.gz gnuradio-96583a9009478242c51ecfd7bb4321ed3d90e3b8.tar.bz2 gnuradio-96583a9009478242c51ecfd7bb4321ed3d90e3b8.zip |
Merge branch 'master' of gnuradio.org:gnuradio
Diffstat (limited to 'volk/apps/volk_profile.cc')
-rw-r--r-- | volk/apps/volk_profile.cc | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/volk/apps/volk_profile.cc b/volk/apps/volk_profile.cc index 648f4d878..e0919a278 100644 --- a/volk/apps/volk_profile.cc +++ b/volk/apps/volk_profile.cc @@ -1,15 +1,19 @@ #include "qa_utils.h" -extern "C" { + #include <volk/volk.h> #include <volk/volk_prefs.h> -} + +#include <ciso646> #include <vector> #include <boost/foreach.hpp> +#include <boost/filesystem.hpp> #include <iostream> #include <fstream> #include <sys/stat.h> #include <sys/types.h> +namespace fs = boost::filesystem; + int main(int argc, char *argv[]) { std::vector<std::string> results; @@ -123,25 +127,20 @@ int main(int argc, char *argv[]) { VOLK_PROFILE(volk_32f_s32f_multiply_32f_a, 1e-4, 1.0, 204600, 10000, &results); VOLK_PROFILE(volk_32f_s32f_multiply_32f_u, 1e-4, 0, 204600, 1000, &results); - - char path[256]; + char path[1024]; 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()); + const fs::path config_path(path); + + if (not fs::exists(config_path.branch_path())) + { + std::cout << "Creating " << config_path.branch_path() << "..." << std::endl; + fs::create_directories(config_path.branch_path()); + } + + std::cout << "Writing " << config_path << "..." << std::endl; + std::ofstream config(config_path.string().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; - } + std::cout << "Error opening file " << config_path << std::endl; } config << "\ |