summaryrefslogtreecommitdiff
path: root/volk
diff options
context:
space:
mode:
authorNick Foster2011-05-12 15:39:56 -0700
committerNick Foster2011-05-12 15:39:56 -0700
commitb0e781a55387e02ef8126219ccfe8b3c48a838f5 (patch)
tree1cbd92aff7e2af8be91571f5f9273f600cdee7d0 /volk
parent256304ee92f49b536358252693a2083f211e1e37 (diff)
downloadgnuradio-b0e781a55387e02ef8126219ccfe8b3c48a838f5.tar.gz
gnuradio-b0e781a55387e02ef8126219ccfe8b3c48a838f5.tar.bz2
gnuradio-b0e781a55387e02ef8126219ccfe8b3c48a838f5.zip
Volk: move configuration into ~/.volk instead of ~/.gnuradio, add ability to create dir in profiler if not exist
Diffstat (limited to 'volk')
-rw-r--r--volk/apps/volk_profile.cc26
-rw-r--r--volk/lib/volk_prefs.c2
2 files changed, 22 insertions, 6 deletions
diff --git a/volk/apps/volk_profile.cc b/volk/apps/volk_profile.cc
index 49e6db3fc..3fe227400 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\
diff --git a/volk/lib/volk_prefs.c b/volk/lib/volk_prefs.c
index bd15c130e..ebfe3bc40 100644
--- a/volk/lib/volk_prefs.c
+++ b/volk/lib/volk_prefs.c
@@ -8,7 +8,7 @@
//#endif
void get_config_path(char *path) {
- const char *suffix = "/.gnuradio/volk_config";
+ const char *suffix = "/.volk/volk_config";
strcpy(path, getenv("HOME"));
strcat(path, suffix);
}