Diff of /libperf_events/operf_counter.cpp [85d9b9] .. [2dcd13]  Maximize  Restore

Switch to unified view

a/libperf_events/operf_counter.cpp b/libperf_events/operf_counter.cpp
...
...
20
#include <sys/ioctl.h>
20
#include <sys/ioctl.h>
21
#include <signal.h>
21
#include <signal.h>
22
#include <errno.h>
22
#include <errno.h>
23
#include <string.h>
23
#include <string.h>
24
#include <iostream>
24
#include <iostream>
25
#include <sstream>
25
#include <stdlib.h>
26
#include <stdlib.h>
26
#include "op_events.h"
27
#include "op_events.h"
27
#include "operf_counter.h"
28
#include "operf_counter.h"
28
#include "op_abi.h"
29
#include "op_abi.h"
29
#include "cverb.h"
30
#include "cverb.h"
...
...
431
{
432
{
432
    // It's overkill to blindly do this assignment below every time, since this function
433
    // It's overkill to blindly do this assignment below every time, since this function
433
    // is invoked once for each event for each cpu; but it's not worth the bother of trying
434
    // is invoked once for each event for each cpu; but it's not worth the bother of trying
434
    // to avoid it.
435
    // to avoid it.
435
    opHeader.h_attrs[event].attr = attr;
436
    opHeader.h_attrs[event].attr = attr;
437
  ostringstream message;
436
    cverb << vrecord << "Perf header: id = " << hex << (unsigned long long)id << " for event num "
438
    message  << "Perf header: id = " << hex << (unsigned long long)id << " for event num "
437
          << event << ", code " << attr.config <<  endl;
439
             << event << ", code " << attr.config <<  endl;
440
  cverb << vrecord << message.str();
438
    opHeader.h_attrs[event].ids.push_back(id);
441
    opHeader.h_attrs[event].ids.push_back(id);
439
}
442
}
440
443
441
void operf_record::write_op_header_info()
444
void operf_record::write_op_header_info()
442
{
445
{
...
...
834
            if (op_read_from_stream(istrm, (char *)& perf_id, perfid_size) != perfid_size) {
837
            if (op_read_from_stream(istrm, (char *)& perf_id, perfid_size) != perfid_size) {
835
                cerr << "Error: Unexpected end of input file " << inputFname << "." << endl;
838
                cerr << "Error: Unexpected end of input file " << inputFname << "." << endl;
836
                ret = OP_PERF_HANDLED_ERROR;
839
                ret = OP_PERF_HANDLED_ERROR;
837
                goto out;
840
                goto out;
838
            }
841
            }
842
          ostringstream message;
839
            cverb << vconvert << "Perf header: id = " << hex << (unsigned long long)perf_id << endl;
843
            message << "Perf header: id = " << hex << (unsigned long long)perf_id << endl;
844
          cverb << vconvert << message.str();
840
            opHeader.h_attrs[i].ids.push_back(perf_id);
845
            opHeader.h_attrs[i].ids.push_back(perf_id);
841
        }
846
        }
842
        istrm.seekg(next_f_attr, ios_base::beg);
847
        istrm.seekg(next_f_attr, ios_base::beg);
843
    }
848
    }
844
out:
849
out:
...
...
924
            streamsize perfid_size = sizeof(perf_id);
929
            streamsize perfid_size = sizeof(perf_id);
925
            if (read(sample_data_fd, (char *)& perf_id, perfid_size) != perfid_size) {
930
            if (read(sample_data_fd, (char *)& perf_id, perfid_size) != perfid_size) {
926
                errmsg = "Error reading perf ID on sample data pipe: " + string(strerror(errno));
931
                errmsg = "Error reading perf ID on sample data pipe: " + string(strerror(errno));
927
                goto fail;
932
                goto fail;
928
            }
933
            }
934
          ostringstream message;
929
            cverb << vconvert << "Perf header: id = " << hex << (unsigned long long)perf_id << endl;
935
            message << "Perf header: id = " << hex << (unsigned long long)perf_id << endl;
936
          cverb << vconvert << message.str();
930
            opHeader.h_attrs[i].ids.push_back(perf_id);
937
            opHeader.h_attrs[i].ids.push_back(perf_id);
931
        }
938
        }
932
939
933
    }
940
    }
934
    valid = true;
941
    valid = true;
...
...
992
    }
999
    }
993
1000
994
    for (int i = 0; i < OPERF_MAX_STATS; i++)
1001
    for (int i = 0; i < OPERF_MAX_STATS; i++)
995
        operf_stats[i] = 0;
1002
        operf_stats[i] = 0;
996
1003
1004
  ostringstream message;
997
    cverb << vdebug << "Converting operf data to oprofile sample data format" << endl;
1005
    message << "Converting operf data to oprofile sample data format" << endl;
998
    cverb << vdebug << "sample type is " << hex <<  opHeader.h_attrs[0].attr.sample_type << endl;
1006
    message << "sample type is " << hex <<  opHeader.h_attrs[0].attr.sample_type << endl;
1007
  cverb << vdebug << message.str();
999
    first_time_processing = true;
1008
    first_time_processing = true;
1000
    int num_recs = 0;
1009
    int num_recs = 0;
1001
    struct perf_event_header last_header;
1010
    struct perf_event_header last_header;
1002
    bool print_progress = !inputFname.empty() && syswide;
1011
    bool print_progress = !inputFname.empty() && syswide;
1003
    if (print_progress)
1012
    if (print_progress)

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks