commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 02/08: volk: don't write to volk_config if


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/08: volk: don't write to volk_config if using regex
Date: Fri, 7 Mar 2014 00:24:06 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

trondeau pushed a commit to branch master
in repository gnuradio.

commit 0fe6492519b207d18732c9ea8e98863a9e43eb18
Author: Nathan West <address@hidden>
Date:   Sun Mar 2 15:47:26 2014 -0600

    volk: don't write to volk_config if using regex
---
 volk/apps/volk_profile.cc | 55 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 35 insertions(+), 20 deletions(-)

diff --git a/volk/apps/volk_profile.cc b/volk/apps/volk_profile.cc
index 103dfdc..b3965d0 100644
--- a/volk/apps/volk_profile.cc
+++ b/volk/apps/volk_profile.cc
@@ -16,6 +16,7 @@
 namespace fs = boost::filesystem;
 
 int main(int argc, char *argv[]) {
+    // Adding program options
     boost::program_options::options_description desc("Options");
     desc.add_options()
       ("help,h", "Print help messages")
@@ -26,18 +27,24 @@ int main(int argc, char *argv[]) {
             boost::program_options::value<std::string>(),
             "Run tests matching regular expression.")
       ;
+
+    // Handle the options that were given
     boost::program_options::variables_map vm;
     bool benchmark_mode;
     std::string kernel_regex;
+    bool store_results = true;
     try {
         
boost::program_options::store(boost::program_options::parse_command_line(argc, 
argv, desc), vm);
         boost::program_options::notify(vm);
-        benchmark_mode, kernel_regex = 
vm.count("benchmark")?vm["benchmark"].as<bool>():false;
+        benchmark_mode = 
vm.count("benchmark")?vm["benchmark"].as<bool>():false;
         if ( vm.count("tests-regex" ) ) {
             kernel_regex = vm["tests-regex"].as<std::string>();
+            store_results = false;
+            std::cout << "Warning: using a regexp will not save results to a 
config" << std::endl;
         }
         else {
             kernel_regex = ".*";
+            store_results = true;
         }
     } catch (boost::program_options::error& error) {
         std::cerr << "Error: " << error.what() << std::endl << std::endl;
@@ -54,6 +61,7 @@ int main(int argc, char *argv[]) {
     }
 
 
+    // Run tests
     std::vector<std::string> results;
 
     //VOLK_PROFILE(volk_16i_x5_add_quad_16i_x4, 1e-4, 2046, 10000, &results, 
benchmark_mode, kernel_regex);
@@ -145,30 +153,37 @@ int main(int argc, char *argv[]) {
     VOLK_PROFILE(volk_32fc_s32fc_multiply_32fc, 1e-4, 0, 204602, 1000, 
&results, benchmark_mode, kernel_regex);
     VOLK_PROFILE(volk_32f_s32f_multiply_32f, 1e-4, 1.0, 204602, 10000, 
&results, benchmark_mode, kernel_regex);
 
-    char path[1024];
-    volk_get_config_path(path);
+    // Until we can update the config on a kernel by kernel basis
+    // do not overwrite volk_config when using a regex.
+    if(store_results) {
+        char path[1024];
+        volk_get_config_path(path);
 
-    const fs::path config_path(path);
+        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());
-    }
+        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::cout << "Error opening file " << config_path << std::endl;
-    }
+        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::cout << "Error opening file " << config_path << std::endl;
+        }
 
-    config << "\
-#this file is generated by volk_profile.\n\
-#the function name is followed by the preferred architecture.\n\
+        config << "\
+#thi    s file is generated by volk_profile.\n\
+#the     function name is followed by the preferred architecture.\n\
 ";
 
-    BOOST_FOREACH(std::string result, results) {
-        config << result << std::endl;
+        BOOST_FOREACH(std::string result, results) {
+            config << result << std::endl;
+        }
+        config.close();
+    }
+    else {
+        std::cout << "Warning: config not generated" << std::endl;
     }
-    config.close();
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]