| 34 | TimeTraceModel::TimeTraceModel(Context* c, QObject *parent) : QAbstractTableModel(parent), context(c) {} |
| 35 | |
| 36 | void 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 | |
| 58 | int TimeTraceModel::rowCount(const QModelIndex & /*parent*/) const |
| 59 | { |
no test coverage detected