Otherwise, we cannot print 64bit records on 32bit machines.
clear();
LineReader reader;
- size_t timeStamp = 0;
+ uint64_t timeStamp = 0;
vector<StringIndex> opNewStrIndices;
opNewStrIndices.reserve(16);
opNewIpIndices.push_back(index);
}
} else if (reader.mode() == '+') {
- size_t size = 0;
+ uint64_t size = 0;
TraceIndex traceId;
- uintptr_t ptr = 0;
+ uint64_t ptr = 0;
if (!(reader >> size) || !(reader >> traceId) || !(reader >> ptr)) {
cerr << "failed to parse line: " << reader.line() << endl;
continue;
++sizeHistogram[size];
}
} else if (reader.mode() == '-') {
- uintptr_t ptr = 0;
+ uint64_t ptr = 0;
if (!(reader >> ptr)) {
cerr << "failed to parse line: " << reader.line() << endl;
continue;
// comment or empty line
continue;
} else if (reader.mode() == 'c') {
- size_t newStamp = 0;
+ uint64_t newStamp = 0;
if (!(reader >> newStamp)) {
cerr << "Failed to read time stamp: " << reader.line() << endl;
continue;
/// these are leaks, but we now have the same data in \c allocations as well
activeAllocations.clear();
- totalTime = max(timeStamp, size_t(1));
+ totalTime = max(timeStamp, uint64_t(1));
handleTimeStamp(timeStamp, totalTime);
template<typename Base>
struct Index
{
- size_t index = 0;
+ uint64_t index = 0;
explicit operator bool() const
{
struct InstructionPointer
{
- uintptr_t instructionPointer = 0;
+ uint64_t instructionPointer = 0;
ModuleIndex moduleIndex;
FunctionIndex functionIndex;
FileIndex fileIndex;
struct AllocationData
{
// number of allocations
- size_t allocations = 0;
+ uint64_t allocations = 0;
// bytes allocated in total
- size_t allocated = 0;
+ uint64_t allocated = 0;
// amount of bytes leaked
- size_t leaked = 0;
+ uint64_t leaked = 0;
// largest amount of bytes allocated
- size_t peak = 0;
+ uint64_t peak = 0;
};
struct Allocation : public AllocationData
struct AllocationInfo
{
TraceIndex traceIndex;
- size_t size;
+ uint64_t size;
};
struct AccumulatedTraceData
AccumulatedTraceData();
virtual ~AccumulatedTraceData() = default;
- virtual void handleTimeStamp(size_t newStamp, size_t oldStamp) = 0;
+ virtual void handleTimeStamp(uint64_t newStamp, uint64_t oldStamp) = 0;
virtual void handleAllocation() = 0;
virtual void handleDebuggee(const char* command) = 0;
bool fromAttached = false;
std::vector<Allocation> allocations;
- std::map<size_t, size_t> sizeHistogram;
- size_t totalAllocated = 0;
- size_t totalAllocations = 0;
- size_t peak = 0;
- size_t leaked = 0;
- size_t totalTime = 0;
+ std::map<uint64_t, uint64_t> sizeHistogram;
+ uint64_t totalAllocated = 0;
+ uint64_t totalAllocations = 0;
+ uint64_t peak = 0;
+ uint64_t leaked = 0;
+ uint64_t totalTime = 0;
// our indices are sequentially increasing thus a new allocation can only ever
// occur with an index larger than any other we encountered so far
// indices of functions that should stop the backtrace, e.g. main or static initialization
std::vector<StringIndex> stopIndices;
- std::unordered_map<uintptr_t, AllocationInfo> activeAllocations;
+ std::unordered_map<uint64_t, AllocationInfo> activeAllocations;
std::vector<InstructionPointer> instructionPointers;
std::vector<TraceNode> traces;
std::vector<std::string> strings;
class formatBytes
{
public:
- formatBytes(size_t bytes)
+ formatBytes(uint64_t bytes)
: m_bytes(bytes)
{
}
friend ostream& operator<<(ostream& out, const formatBytes data);
private:
- size_t m_bytes;
+ uint64_t m_bytes;
};
ostream& operator<<(ostream& out, const formatBytes data)
}
}
- void handleTimeStamp(size_t /*newStamp*/, size_t oldStamp) override
+ void handleTimeStamp(uint64_t /*newStamp*/, uint64_t oldStamp) override
{
if (massifOut.is_open()) {
writeMassifSnapshot(oldStamp, oldStamp == totalTime);
vector<MergedAllocation> mergedAllocations;
- size_t massifSnapshotId = 0;
- size_t lastMassifPeak = 0;
+ uint64_t massifSnapshotId = 0;
+ uint64_t lastMassifPeak = 0;
vector<Allocation> massifAllocations;
ofstream massifOut;
double massifThreshold = 1;
- size_t massifDetailedFreq = 1;
+ uint64_t massifDetailedFreq = 1;
string filterBtFunction;
};
return true;
}
- bool operator>>(std::size_t& hex)
+ bool operator>>(uint64_t& hex)
+ {
+ return readHex(hex);
+ }
+
+ // only for usage in heaptrack_interpret
+ bool operator>>(uint32_t& hex)
{
return readHex(hex);
}