Commit c183e944 authored by rdubner's avatar rdubner

Fix up cobcd-st PROFILER calls

parent 033950f8
...@@ -96,6 +96,7 @@ CreateSymc(PARAMETERS &params, ...@@ -96,6 +96,7 @@ CreateSymc(PARAMETERS &params,
bool tack_on_python, bool tack_on_python,
bool tack_on_filename) bool tack_on_filename)
{ {
PROFILER;
/* This routine creates the .sym.c file, which contains a global /* This routine creates the .sym.c file, which contains a global
variable comprising the cross-reference information, followed variable comprising the cross-reference information, followed
by the magical construction that puts the cobcd.py script by the magical construction that puts the cobcd.py script
......
...@@ -76,6 +76,7 @@ ProcessDataStorage(ifstream &ifs, ...@@ -76,6 +76,7 @@ ProcessDataStorage(ifstream &ifs,
COB_FIELDS &cob_fields COB_FIELDS &cob_fields
) )
{ {
PROFILER;
ifs.clear(); ifs.clear();
ifs.seekg(0); ifs.seekg(0);
...@@ -435,6 +436,7 @@ ScanAllDotHFiles(const string &path, ...@@ -435,6 +436,7 @@ ScanAllDotHFiles(const string &path,
COB_FIELDS &cob_fields COB_FIELDS &cob_fields
) )
{ {
PROFILER;
vector<string>AllDotHFiles = DirectoryScan(path,fname,"*.h"); vector<string>AllDotHFiles = DirectoryScan(path,fname,"*.h");
for(vector<string>::const_iterator filename = AllDotHFiles.begin(); filename != AllDotHFiles.end(); filename++) { for(vector<string>::const_iterator filename = AllDotHFiles.begin(); filename != AllDotHFiles.end(); filename++) {
ifstream ifs; ifstream ifs;
...@@ -466,6 +468,7 @@ ScanForLinkage(ifstream &ifs, ...@@ -466,6 +468,7 @@ ScanForLinkage(ifstream &ifs,
COB_FIELDS &cob_fields COB_FIELDS &cob_fields
) )
{ {
PROFILER;
// This routine actually does two things, but we put them together here so that // This routine actually does two things, but we put them together here so that
// we have to scan the .c file only once. // we have to scan the .c file only once.
...@@ -473,7 +476,6 @@ ScanForLinkage(ifstream &ifs, ...@@ -473,7 +476,6 @@ ScanForLinkage(ifstream &ifs,
// We also look for b_xx / f_yy assocations for LINKAGE-SECTION variables // We also look for b_xx / f_yy assocations for LINKAGE-SECTION variables
CPROFILER;
ifs.clear(); ifs.clear();
ifs.seekg(0); ifs.seekg(0);
...@@ -700,6 +702,7 @@ ScanForLinkage(ifstream &ifs, ...@@ -700,6 +702,7 @@ ScanForLinkage(ifstream &ifs,
void void
COB_PROGRAM_LABELS::FormatProgramInfo(stringstream &ss) const COB_PROGRAM_LABELS::FormatProgramInfo(stringstream &ss) const
{ {
CPROFILER;
for(VCOB_PROGRAM_LABEL::const_iterator it=program_labels.begin(); for(VCOB_PROGRAM_LABEL::const_iterator it=program_labels.begin();
it != program_labels.end(); it != program_labels.end();
it++ ) { it++ ) {
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "profiler.h" #include "profiler.h"
#if __GNUC__ >= 7 #if __GNUC__ >= 7 || defined(_WIN32)
// These are static variables for the PPROFILER class // These are static variables for the PPROFILER class
std::map<std::string,double> PPROFILER::ProfilerRoutineTimes; std::map<std::string,double> PPROFILER::ProfilerRoutineTimes;
......
...@@ -30,8 +30,7 @@ ...@@ -30,8 +30,7 @@
#pragma once #pragma once
#if __GNUC__ >= 7 || defined(_WIN32)
#if __GNUC__ >= 7
#include <map> #include <map>
#include <map> #include <map>
...@@ -43,7 +42,7 @@ ...@@ -43,7 +42,7 @@
#include <algorithm> #include <algorithm>
#include "utils.h" #include "utils.h"
//#define PROFILING #define PROFILING
class PPROFILER class PPROFILER
{ {
......
...@@ -120,6 +120,7 @@ next_c: ...@@ -120,6 +120,7 @@ next_c:
string string
Replace(const string &s,const char was, const char is) Replace(const string &s,const char was, const char is)
{ {
PROFILER;
string retval; string retval;
for(size_t i=0; i<s.size(); i++) { for(size_t i=0; i<s.size(); i++) {
...@@ -135,6 +136,7 @@ Replace(const string &s,const char was, const char is) ...@@ -135,6 +136,7 @@ Replace(const string &s,const char was, const char is)
string string
Upper(const string &s) Upper(const string &s)
{ {
PROFILER;
string retval; string retval;
for(size_t i=0; i<s.size(); i++) { for(size_t i=0; i<s.size(); i++) {
char ch = s[i]; char ch = s[i];
...@@ -146,6 +148,7 @@ Upper(const string &s) ...@@ -146,6 +148,7 @@ Upper(const string &s)
string string
ZeroIsNull(const LONGLONG &v) ZeroIsNull(const LONGLONG &v)
{ {
PROFILER;
string retval; string retval;
stringstream ss; stringstream ss;
if( v != 0 ) { if( v != 0 ) {
...@@ -157,5 +160,6 @@ ZeroIsNull(const LONGLONG &v) ...@@ -157,5 +160,6 @@ ZeroIsNull(const LONGLONG &v)
int int
STOI(const string &s) STOI(const string &s)
{ {
PROFILER;
return atoi(s.c_str()); return atoi(s.c_str());
} }
...@@ -640,6 +640,7 @@ VARIABLE_TREE::ReadFromFile(std::ifstream &ifs) ...@@ -640,6 +640,7 @@ VARIABLE_TREE::ReadFromFile(std::ifstream &ifs)
void void
VARIABLE_TREE::DumpNode(ostream &sout, const VAR_NODE *node) VARIABLE_TREE::DumpNode(ostream &sout, const VAR_NODE *node)
{ {
PROFILER;
if(node) { if(node) {
if(node !=root) { if(node !=root) {
if( node->program != current_program_in_dump if( node->program != current_program_in_dump
...@@ -735,6 +736,7 @@ VARIABLE_TREE::DumpNode(ostream &sout, const VAR_NODE *node) ...@@ -735,6 +736,7 @@ VARIABLE_TREE::DumpNode(ostream &sout, const VAR_NODE *node)
void void
VARIABLE_TREE::Dump(ostream &sout) VARIABLE_TREE::Dump(ostream &sout)
{ {
PROFILER;
// Primarily for debugging. // Primarily for debugging.
// Dump the whole tree, depth first: // Dump the whole tree, depth first:
current_program_in_dump.clear(); current_program_in_dump.clear();
...@@ -747,6 +749,7 @@ VARIABLE_TREE::Dump(ostream &sout) ...@@ -747,6 +749,7 @@ VARIABLE_TREE::Dump(ostream &sout)
static VAR_NODE * static VAR_NODE *
FindNameIn(VAR_NODE *node,const string &name) FindNameIn(VAR_NODE *node,const string &name)
{ {
PROFILER;
if( node->GetLevel() != LEVEL_66 AND node->GetName() EQ name ) { if( node->GetLevel() != LEVEL_66 AND node->GetName() EQ name ) {
return node; return node;
} }
...@@ -763,6 +766,7 @@ FindNameIn(VAR_NODE *node,const string &name) ...@@ -763,6 +766,7 @@ FindNameIn(VAR_NODE *node,const string &name)
void void
VARIABLE_TREE::BuildCanonicalName(VAR_NODE *var_node) VARIABLE_TREE::BuildCanonicalName(VAR_NODE *var_node)
{ {
PROFILER;
/* We are going to take our variable tree, with its basic structure /* We are going to take our variable tree, with its basic structure
PROGRAM PROGRAM
...@@ -1026,6 +1030,7 @@ VARIABLE_TREE::BuildCanonicalName() ...@@ -1026,6 +1030,7 @@ VARIABLE_TREE::BuildCanonicalName()
void void
VARIABLE_TREE::BuildFlatList(VAR_NODE *node,VVAR_NODES &flat) VARIABLE_TREE::BuildFlatList(VAR_NODE *node,VVAR_NODES &flat)
{ {
PROFILER;
if( node EQ NULL ) { if( node EQ NULL ) {
// This one must've been moved by a RENAMES clause // This one must've been moved by a RENAMES clause
return; return;
...@@ -1044,6 +1049,7 @@ VARIABLE_TREE::BuildFlatList(VAR_NODE *node,VVAR_NODES &flat) ...@@ -1044,6 +1049,7 @@ VARIABLE_TREE::BuildFlatList(VAR_NODE *node,VVAR_NODES &flat)
void void
VARIABLE_TREE::AdjustFlatList() VARIABLE_TREE::AdjustFlatList()
{ {
PROFILER;
/* When there is, after an 00 FILE record, an 01 variable that isn't /* When there is, after an 00 FILE record, an 01 variable that isn't
referenced in the code, you end up with that 01 not being associated referenced in the code, you end up with that 01 not being associated
with a b_ base symbol. with a b_ base symbol.
...@@ -1069,6 +1075,7 @@ VARIABLE_TREE::Consolidive(VAR_NODE *node, ...@@ -1069,6 +1075,7 @@ VARIABLE_TREE::Consolidive(VAR_NODE *node,
string &base_symbol, string &base_symbol,
const COB_FIELDS &cob_fields) const COB_FIELDS &cob_fields)
{ {
PROFILER;
if( node ) { if( node ) {
VSTRING tokens = Split(node->GetCanonicalName(),"/"); VSTRING tokens = Split(node->GetCanonicalName(),"/");
if( tokens.size() >= 2 ) { if( tokens.size() >= 2 ) {
...@@ -1129,6 +1136,7 @@ void ...@@ -1129,6 +1136,7 @@ void
VARIABLE_TREE::PropogateBaseName(VAR_NODE *node, VARIABLE_TREE::PropogateBaseName(VAR_NODE *node,
string &base_symbol) string &base_symbol)
{ {
PROFILER;
if( node ) { if( node ) {
if( node->level <= 1 OR node->level EQ 77 ) { if( node->level <= 1 OR node->level EQ 77 ) {
base_symbol = node->b_name; base_symbol = node->b_name;
...@@ -1149,6 +1157,7 @@ VARIABLE_TREE::PropogateBaseName(VAR_NODE *node, ...@@ -1149,6 +1157,7 @@ VARIABLE_TREE::PropogateBaseName(VAR_NODE *node,
void void
VARIABLE_TREE::Consolidate(const COB_FIELDS &cob_fields) VARIABLE_TREE::Consolidate(const COB_FIELDS &cob_fields)
{ {
PROFILER;
// data_description has f_ and b_ entries for working-storage and linkage // data_description has f_ and b_ entries for working-storage and linkage
// variables that are referenced in the COBOL code // variables that are referenced in the COBOL code
...@@ -1176,6 +1185,7 @@ VARIABLE_TREE::Consolidate(const COB_FIELDS &cob_fields) ...@@ -1176,6 +1185,7 @@ VARIABLE_TREE::Consolidate(const COB_FIELDS &cob_fields)
void void
VARIABLE_TREE::DumpANode(const VAR_NODE *node) const VARIABLE_TREE::DumpANode(const VAR_NODE *node) const
{ {
PROFILER;
cout << setw(20) << node->program; cout << setw(20) << node->program;
cout << setw(20) << node->section; cout << setw(20) << node->section;
cout << setw(13) << node->type; cout << setw(13) << node->type;
...@@ -1198,6 +1208,7 @@ VARIABLE_TREE::DumpANode(const VAR_NODE *node) const ...@@ -1198,6 +1208,7 @@ VARIABLE_TREE::DumpANode(const VAR_NODE *node) const
void void
VARIABLE_TREE::DumpFlatList() const VARIABLE_TREE::DumpFlatList() const
{ {
PROFILER;
cout << "VARIABLE_TREE::FlatList:" << endl; cout << "VARIABLE_TREE::FlatList:" << endl;
cout << setw(20) << "program"; cout << setw(20) << "program";
cout << setw(20) << "section"; cout << setw(20) << "section";
...@@ -1232,6 +1243,7 @@ VARIABLE_TREE::FormatVariablesInfo(stringstream &ss, ...@@ -1232,6 +1243,7 @@ VARIABLE_TREE::FormatVariablesInfo(stringstream &ss,
const COB_FIELD_ATTRIBUTES &cob_field_attributes, const COB_FIELD_ATTRIBUTES &cob_field_attributes,
const COB_PIC_SYMBOLS &cob_pic_symbols) const const COB_PIC_SYMBOLS &cob_pic_symbols) const
{ {
PROFILER;
for(VVAR_NODES::const_iterator it=flat_list.begin(); it!=flat_list.end(); it++) { for(VVAR_NODES::const_iterator it=flat_list.begin(); it!=flat_list.end(); it++) {
VAR_NODE *node = *it; VAR_NODE *node = *it;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment