MCPcopy Create free account
hub / github.com/clementgallet/libTAS / addCall

Method addCall

src/program/ui/TimeTraceModel.cpp:36–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34TimeTraceModel::TimeTraceModel(Context* c, QObject *parent) : QAbstractTableModel(parent), context(c) {}
35
36void TimeTraceModel::addCall(int type, unsigned long long hash, std::string stacktrace)
37{
38 auto it = time_calls_map.find(hash);
39 if (it != time_calls_map.end()) {
40 if ((!stacktrace.empty()) && stacktrace.compare(it->second.stacktrace) != 0) {
41 std::cerr << "Same hash but stack trace differ!" << std::endl;
42 std::cerr << "Stored trace:" << std::endl;
43 std::cerr << it->second.stacktrace << std::endl;
44 std::cerr << "New trace:" << std::endl;
45 std::cerr << stacktrace << std::endl;
46 }
47 it->second.count++;
48 /* TODO: Get the row index? */
49 emit dataChanged(index(0,1), index(rowCount()-1,1));
50 }
51 else {
52 beginInsertRows(QModelIndex(), time_calls_map.size(), time_calls_map.size());
53 time_calls_map[hash] = {type, 1, stacktrace};
54 endInsertRows();
55 }
56}
57
58int TimeTraceModel::rowCount(const QModelIndex & /*parent*/) const
59{

Callers 1

addTimeTraceMethod · 0.80

Calls 4

findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected