bool AccumulatedTraceData::read(istream& in)
{
LineReader reader;
- uint64_t timeStamp = 0;
+ int64_t timeStamp = 0;
vector<string> opNewStrings = {
// 64 bit
const auto& info = allocationInfos[allocationInfoIndex.index];
auto& allocation = findAllocation(info.traceIndex);
- if (!allocation.allocations || static_cast<uint64_t>(allocation.leaked) < info.size) {
- if (!fromAttached) {
- cerr << "inconsistent allocation info, underflowed allocations of " << info.traceIndex << endl;
- }
- allocation.leaked = 0;
- allocation.allocations = 0;
- } else {
- allocation.leaked -= info.size;
- }
+ allocation.leaked -= info.size;
totalCost.leaked -= info.size;
if (temporary) {
++allocation.temporary;
// comment or empty line
continue;
} else if (reader.mode() == 'c') {
- uint64_t newStamp = 0;
+ int64_t newStamp = 0;
if (!(reader >> newStamp)) {
cerr << "Failed to read time stamp: " << reader.line() << endl;
continue;
handleTimeStamp(timeStamp, newStamp);
timeStamp = newStamp;
} else if (reader.mode() == 'R') { // RSS timestamp
- uint64_t rss = 0;
+ int64_t rss = 0;
reader >> rss;
if (rss > peakRSS) {
peakRSS = rss;
void AccumulatedTraceData::diff(const AccumulatedTraceData& base)
{
totalCost -= base.totalCost;
+ totalTime -= base.totalTime;
+ peakRSS -= base.peakRSS;
+ systemInfo.pages -= base.systemInfo.pages;
+ systemInfo.pageSize -= base.systemInfo.pageSize;
// step 0: remap strings and ips
const auto& stringMap = remapStrings(strings, base.strings);
AccumulatedTraceData();
virtual ~AccumulatedTraceData() = default;
- virtual void handleTimeStamp(uint64_t oldStamp, uint64_t newStamp) = 0;
+ virtual void handleTimeStamp(int64_t oldStamp, int64_t newStamp) = 0;
virtual void handleAllocation(const AllocationInfo& info, const AllocationIndex index) = 0;
virtual void handleDebuggee(const char* command) = 0;
std::vector<Allocation> allocations;
AllocationData totalCost;
- uint64_t totalTime = 0;
- uint64_t peakTime = 0;
- uint64_t peakRSS = 0;
+ int64_t totalTime = 0;
+ int64_t peakTime = 0;
+ int64_t peakRSS = 0;
struct SystemInfo {
- uint64_t pages = 0;
- uint64_t pageSize = 0;
+ int64_t pages = 0;
+ int64_t pageSize = 0;
};
SystemInfo systemInfo;
enum {
MAX_NUM_COST = 20
};
- quint64 timeStamp = 0;
+ // time in ms
+ qint64 timeStamp = 0;
std::array<qint64, MAX_NUM_COST> cost;
};
Q_DECLARE_TYPEINFO(ChartRows, Q_MOVABLE_TYPE);
findTopChartEntries(&ChartMergeData::temporary, &LabelIds::temporary, &temporaryChartData);
}
- void handleTimeStamp(uint64_t /*oldStamp*/, uint64_t newStamp)
+ void handleTimeStamp(int64_t /*oldStamp*/, int64_t newStamp)
{
if (!buildCharts) {
return;
}
maxConsumedSinceLastTimeStamp = max(maxConsumedSinceLastTimeStamp, totalCost.leaked);
- const uint64_t diffBetweenTimeStamps = totalTime / MAX_CHART_DATAPOINTS;
+ const int64_t diffBetweenTimeStamps = totalTime / MAX_CHART_DATAPOINTS;
if (newStamp != totalTime && newStamp - lastTimeStamp < diffBetweenTimeStamps) {
return;
}
lastTimeStamp = newStamp;
// create the rows
- auto createRow = [] (uint64_t timeStamp, int64_t totalCost) {
+ auto createRow = [] (int64_t timeStamp, int64_t totalCost) {
ChartRows row;
row.timeStamp = timeStamp;
row.cost[0] = totalCost;
};
QHash<IpIndex, LabelIds> labelIds;
int64_t maxConsumedSinceLastTimeStamp = 0;
- uint64_t lastTimeStamp = 0;
+ int64_t lastTimeStamp = 0;
StringCache stringCache;
{
QString debuggee;
AllocationData cost;
- uint64_t totalTime;
- uint64_t peakTime;
- uint64_t peakRSS;
- uint64_t totalSystemMemory;
+ int64_t totalTime;
+ int64_t peakTime;
+ int64_t peakRSS;
+ int64_t totalSystemMemory;
};
Q_DECLARE_METATYPE(SummaryData);
switch (static_cast<Columns>(index.column())) {
case AllocatedColumn:
if (role == SortRole || role == MaxCostRole) {
- return static_cast<quint64>(abs(row->cost.allocated));
+ return static_cast<qint64>(abs(row->cost.allocated));
}
return m_format.formatByteSize(row->cost.allocated);
case AllocationsColumn:
if (role == SortRole || role == MaxCostRole) {
- return static_cast<quint64>(abs(row->cost.allocations));
+ return static_cast<qint64>(abs(row->cost.allocations));
}
return static_cast<qint64>(row->cost.allocations);
case TemporaryColumn:
if (role == SortRole || role == MaxCostRole) {
- return static_cast<quint64>(abs(row->cost.temporary));
+ return static_cast<qint64>(abs(row->cost.temporary));
}
return static_cast<qint64>(row->cost.temporary);
case PeakColumn:
if (role == SortRole || role == MaxCostRole) {
- return static_cast<quint64>(abs(row->cost.peak));
+ return static_cast<qint64>(abs(row->cost.peak));
} else {
return m_format.formatByteSize(row->cost.peak);
}
case LeakedColumn:
if (role == SortRole || role == MaxCostRole) {
- return static_cast<quint64>(abs(row->cost.leaked));
+ return static_cast<qint64>(abs(row->cost.leaked));
} else {
return m_format.formatByteSize(row->cost.leaked);
}
}
}
- void handleTimeStamp(uint64_t /*oldStamp*/, uint64_t newStamp) override
+ void handleTimeStamp(int64_t /*oldStamp*/, int64_t newStamp) override
{
if (massifOut.is_open()) {
writeMassifSnapshot(newStamp, newStamp == totalTime);
return true;
}
+ bool operator>>(int64_t& hex)
+ {
+ return readHex(hex);
+ }
+
bool operator>>(uint64_t& hex)
{
return readHex(hex);