Skip to content

Commit 360acdb

Browse files
committed
shadow: rebase volk_profile fix
1 parent 15bbbb9 commit 360acdb

File tree

4 files changed

+156
-93
lines changed

4 files changed

+156
-93
lines changed

apps/volk_option_helpers.cc

+83-58
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1-
//
2-
// Created by nathan on 2/1/18.
3-
//
1+
/* -*- c++ -*- */
2+
/*
3+
* Copyright 2018-2020 Free Software Foundation, Inc.
4+
*
5+
* This file is part of GNU Radio
6+
*
7+
* GNU Radio is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 3, or (at your option)
10+
* any later version.
11+
*
12+
* GNU Radio is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with GNU Radio; see the file COPYING. If not, write to
19+
* the Free Software Foundation, Inc., 51 Franklin Street,
20+
* Boston, MA 02110-1301, USA.
21+
*/
22+
423

524
#include "volk_option_helpers.h"
625

@@ -14,68 +33,74 @@
1433
/*
1534
* Option type
1635
*/
17-
option_t::option_t(std::string longform,
18-
std::string shortform,
19-
std::string msg,
20-
void (*callback)())
21-
: longform("--" + longform), shortform("-" + shortform), msg(msg), callback(callback)
36+
option_t::option_t(std::string t_longform,
37+
std::string t_shortform,
38+
std::string t_msg,
39+
void (*t_callback)())
40+
: longform("--" + t_longform),
41+
shortform("-" + t_shortform),
42+
msg(t_msg),
43+
callback(t_callback)
2244
{
2345
option_type = VOID_CALLBACK;
2446
}
2547

26-
option_t::option_t(std::string longform,
27-
std::string shortform,
28-
std::string msg,
29-
void (*callback)(int))
30-
: longform("--" + longform),
31-
shortform("-" + shortform),
32-
msg(msg),
33-
callback((void (*)())callback)
48+
option_t::option_t(std::string t_longform,
49+
std::string t_shortform,
50+
std::string t_msg,
51+
void (*t_callback)(int))
52+
: longform("--" + t_longform),
53+
shortform("-" + t_shortform),
54+
msg(t_msg),
55+
callback((void (*)())t_callback)
3456
{
3557
option_type = INT_CALLBACK;
3658
}
3759

38-
option_t::option_t(std::string longform,
39-
std::string shortform,
40-
std::string msg,
41-
void (*callback)(float))
42-
: longform("--" + longform),
43-
shortform("-" + shortform),
44-
msg(msg),
45-
callback((void (*)())callback)
60+
option_t::option_t(std::string t_longform,
61+
std::string t_shortform,
62+
std::string t_msg,
63+
void (*t_callback)(float))
64+
: longform("--" + t_longform),
65+
shortform("-" + t_shortform),
66+
msg(t_msg),
67+
callback((void (*)())t_callback)
4668
{
4769
option_type = FLOAT_CALLBACK;
4870
}
4971

50-
option_t::option_t(std::string longform,
51-
std::string shortform,
52-
std::string msg,
53-
void (*callback)(bool))
54-
: longform("--" + longform),
55-
shortform("-" + shortform),
56-
msg(msg),
57-
callback((void (*)())callback)
72+
option_t::option_t(std::string t_longform,
73+
std::string t_shortform,
74+
std::string t_msg,
75+
void (*t_callback)(bool))
76+
: longform("--" + t_longform),
77+
shortform("-" + t_shortform),
78+
msg(t_msg),
79+
callback((void (*)())t_callback)
5880
{
5981
option_type = BOOL_CALLBACK;
6082
}
6183

62-
option_t::option_t(std::string longform,
63-
std::string shortform,
64-
std::string msg,
65-
void (*callback)(std::string))
66-
: longform("--" + longform),
67-
shortform("-" + shortform),
68-
msg(msg),
69-
callback((void (*)())callback)
84+
option_t::option_t(std::string t_longform,
85+
std::string t_shortform,
86+
std::string t_msg,
87+
void (*t_callback)(std::string))
88+
: longform("--" + t_longform),
89+
shortform("-" + t_shortform),
90+
msg(t_msg),
91+
callback((void (*)())t_callback)
7092
{
7193
option_type = STRING_CALLBACK;
7294
}
7395

74-
option_t::option_t(std::string longform,
75-
std::string shortform,
76-
std::string msg,
77-
std::string printval)
78-
: longform("--" + longform), shortform("-" + shortform), msg(msg), printval(printval)
96+
option_t::option_t(std::string t_longform,
97+
std::string t_shortform,
98+
std::string t_msg,
99+
std::string t_printval)
100+
: longform("--" + t_longform),
101+
shortform("-" + t_shortform),
102+
msg(t_msg),
103+
printval(t_printval)
79104
{
80105
option_type = STRING;
81106
}
@@ -85,29 +110,29 @@ option_t::option_t(std::string longform,
85110
* Option List
86111
*/
87112

88-
option_list::option_list(std::string program_name) : program_name(program_name)
113+
option_list::option_list(std::string program_name) : d_program_name(program_name)
89114
{
90-
internal_list = std::vector<option_t>();
115+
d_internal_list = std::vector<option_t>();
91116
}
92117

93118

94-
void option_list::add(option_t opt) { internal_list.push_back(opt); }
119+
void option_list::add(option_t opt) { d_internal_list.push_back(opt); }
95120

96121
void option_list::parse(int argc, char** argv)
97122
{
98123
for (int arg_number = 0; arg_number < argc; ++arg_number) {
99-
for (std::vector<option_t>::iterator this_option = internal_list.begin();
100-
this_option != internal_list.end();
124+
for (std::vector<option_t>::iterator this_option = d_internal_list.begin();
125+
this_option != d_internal_list.end();
101126
this_option++) {
102127
int int_val = INT_MIN;
103128
if (this_option->longform == std::string(argv[arg_number]) ||
104129
this_option->shortform == std::string(argv[arg_number])) {
105130

106-
if (present_options.count(this_option->longform) == 0) {
107-
present_options.insert(
131+
if (d_present_options.count(this_option->longform) == 0) {
132+
d_present_options.insert(
108133
std::pair<std::string, int>(this_option->longform, 1));
109134
} else {
110-
present_options[this_option->longform] += 1;
135+
d_present_options[this_option->longform] += 1;
111136
}
112137
switch (this_option->option_type) {
113138
case VOID_CALLBACK:
@@ -184,15 +209,15 @@ void option_list::parse(int argc, char** argv)
184209
}
185210
if (std::string("--help") == std::string(argv[arg_number]) ||
186211
std::string("-h") == std::string(argv[arg_number])) {
187-
present_options.insert(std::pair<std::string, int>("--help", 1));
212+
d_present_options.insert(std::pair<std::string, int>("--help", 1));
188213
help();
189214
}
190215
}
191216
}
192217

193218
bool option_list::present(std::string option_name)
194219
{
195-
if (present_options.count("--" + option_name)) {
220+
if (d_present_options.count("--" + option_name)) {
196221
return true;
197222
} else {
198223
return false;
@@ -201,10 +226,10 @@ bool option_list::present(std::string option_name)
201226

202227
void option_list::help()
203228
{
204-
std::cout << program_name << std::endl;
229+
std::cout << d_program_name << std::endl;
205230
std::cout << " -h [ --help ] \t\tdisplay this help message" << std::endl;
206-
for (std::vector<option_t>::iterator this_option = internal_list.begin();
207-
this_option != internal_list.end();
231+
for (std::vector<option_t>::iterator this_option = d_internal_list.begin();
232+
this_option != d_internal_list.end();
208233
this_option++) {
209234
std::string help_line(" ");
210235
if (this_option->shortform == "-") {

apps/volk_option_helpers.h

+48-30
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1-
//
2-
// Created by nathan on 2/1/18.
3-
//
1+
/* -*- c++ -*- */
2+
/*
3+
* Copyright 2018-2020 Free Software Foundation, Inc.
4+
*
5+
* This file is part of GNU Radio
6+
*
7+
* GNU Radio is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 3, or (at your option)
10+
* any later version.
11+
*
12+
* GNU Radio is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with GNU Radio; see the file COPYING. If not, write to
19+
* the Free Software Foundation, Inc., 51 Franklin Street,
20+
* Boston, MA 02110-1301, USA.
21+
*/
422

523
#ifndef VOLK_VOLK_OPTION_HELPERS_H
624
#define VOLK_VOLK_OPTION_HELPERS_H
@@ -23,30 +41,30 @@ typedef enum {
2341
class option_t
2442
{
2543
public:
26-
option_t(std::string longform,
27-
std::string shortform,
28-
std::string msg,
29-
void (*callback)());
30-
option_t(std::string longform,
31-
std::string shortform,
32-
std::string msg,
33-
void (*callback)(int));
34-
option_t(std::string longform,
35-
std::string shortform,
36-
std::string msg,
37-
void (*callback)(float));
38-
option_t(std::string longform,
39-
std::string shortform,
40-
std::string msg,
41-
void (*callback)(bool));
42-
option_t(std::string longform,
43-
std::string shortform,
44-
std::string msg,
45-
void (*callback)(std::string));
46-
option_t(std::string longform,
47-
std::string shortform,
48-
std::string msg,
49-
std::string printval);
44+
option_t(std::string t_longform,
45+
std::string t_shortform,
46+
std::string t_msg,
47+
void (*t_callback)());
48+
option_t(std::string t_longform,
49+
std::string t_shortform,
50+
std::string t_msg,
51+
void (*t_callback)(int));
52+
option_t(std::string t_longform,
53+
std::string t_shortform,
54+
std::string t_msg,
55+
void (*t_callback)(float));
56+
option_t(std::string t_longform,
57+
std::string t_shortform,
58+
std::string t_msg,
59+
void (*t_callback)(bool));
60+
option_t(std::string t_longform,
61+
std::string t_shortform,
62+
std::string t_msg,
63+
void (*t_callback)(std::string));
64+
option_t(std::string t_longform,
65+
std::string t_shortform,
66+
std::string t_msg,
67+
std::string t_printval);
5068

5169
std::string longform;
5270
std::string shortform;
@@ -69,9 +87,9 @@ class option_list
6987
void help();
7088

7189
private:
72-
std::string program_name;
73-
std::vector<option_t> internal_list;
74-
std::map<std::string, int> present_options;
90+
std::string d_program_name;
91+
std::vector<option_t> d_internal_list;
92+
std::map<std::string, int> d_present_options;
7593
};
7694

7795

apps/volk_profile.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ void read_results(std::vector<volk_test_results_t>* results, std::string path)
231231
found = 127;
232232
}
233233
str_size = config_str.size();
234-
char buffer[128] = { '\0' };
235-
config_str.copy(buffer, found + 1, 0);
236-
buffer[found] = '\0';
237-
single_kernel_result.push_back(std::string(buffer));
234+
char line_buffer[128] = { '\0' };
235+
config_str.copy(line_buffer, found + 1, 0);
236+
line_buffer[found] = '\0';
237+
single_kernel_result.push_back(std::string(line_buffer));
238238
config_str.erase(0, found + 1);
239239
}
240240

apps/volk_profile.h

+21-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
1-
1+
/* -*- c++ -*- */
2+
/*
3+
* Copyright 2012-2014 Free Software Foundation, Inc.
4+
*
5+
* This file is part of GNU Radio
6+
*
7+
* GNU Radio is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 3, or (at your option)
10+
* any later version.
11+
*
12+
* GNU Radio is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with GNU Radio; see the file COPYING. If not, write to
19+
* the Free Software Foundation, Inc., 51 Franklin Street,
20+
* Boston, MA 02110-1301, USA.
21+
*/
222

323
#include <stdbool.h> // for bool
424
#include <iosfwd> // for ofstream

0 commit comments

Comments
 (0)