Auto merge of #2894 - per-gron:dont-export-unless-needed, r=str4d

Make some globals static that can be

I wrote this patch as part of making a Bazel build system but it really is independent from that so I'm putting this as a separate PR.

External linkage does not help and just encourages sloppy dependencies (ie using symbols only declared in a cpp file in some other cpp file) and can lead to weird issues when there are name collisions.
This commit is contained in:
Homu
2018-05-04 15:05:43 -07:00
9 changed files with 36 additions and 34 deletions

View File

@@ -45,8 +45,10 @@ long long get_nsec_cpu_time()
return ts.tv_sec * 1000000000ll + ts.tv_nsec;
}
long long start_time, last_time;
long long start_cpu_time, last_cpu_time;
static long long start_time;
static long long last_time;
static long long start_cpu_time;
static long long last_cpu_time;
void start_profiling()
{
@@ -57,20 +59,20 @@ void start_profiling()
}
std::map<std::string, size_t> invocation_counts;
std::map<std::string, long long> enter_times;
static std::map<std::string, long long> enter_times;
std::map<std::string, long long> last_times;
std::map<std::string, long long> cumulative_times;
//TODO: Instead of analogous maps for time and cpu_time, use a single struct-valued map
std::map<std::string, long long> enter_cpu_times;
std::map<std::string, long long> last_cpu_times;
std::map<std::pair<std::string, std::string>, long long> op_counts;
std::map<std::pair<std::string, std::string>, long long> cumulative_op_counts; // ((msg, data_point), value)
static std::map<std::string, long long> enter_cpu_times;
static std::map<std::string, long long> last_cpu_times;
static std::map<std::pair<std::string, std::string>, long long> op_counts;
static std::map<std::pair<std::string, std::string>, long long> cumulative_op_counts; // ((msg, data_point), value)
// TODO: Convert op_counts and cumulative_op_counts from pair to structs
size_t indentation = 0;
static size_t indentation = 0;
std::vector<std::string> block_names;
static std::vector<std::string> block_names;
std::list<std::pair<std::string, long long*> > op_data_points = {
static std::list<std::pair<std::string, long long*> > op_data_points = {
#ifdef PROFILE_OP_COUNTS
std::make_pair("Fradd", &Fr<default_ec_pp>::add_cnt),
std::make_pair("Frsub", &Fr<default_ec_pp>::sub_cnt),