Commit c183e944 authored by rdubner's avatar rdubner

Fix up cobcd-st PROFILER calls

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