修复火焰图Function页called项无数据问题

Signed-off-by:wenlong12 <wenlong12@huawei.com>

Signed-off-by: wenlong12 <wenlong12@huawei.com>
This commit is contained in:
wenlong12 2024-11-12 15:55:09 +08:00
parent 954da67aca
commit 2492e992d6
2 changed files with 10 additions and 17 deletions

View File

@ -4021,7 +4021,6 @@ input{
if (this.data) {
if (this.reverse) {
this.drawCReverse(
0,
this.c,
1,
{
@ -4120,16 +4119,13 @@ input{
return heatColor;
}
drawCReverse = (parentEvents, c, dept, rect) => {
drawCReverse = (c, dept, rect) => {
let ctx = this.context;
let offset = 0;
if (parentEvents === 0) {
parentEvents = c.reduce((acc, cur) => acc + cur.subEvents, 0);
}
for (let i = 0; i < c.length; i++) {
let funName = this.getFunctionName(c[i].symbol);
let funcId = c[i].symbol;
let percent = c[i].subEvents * 100 / parentEvents;
let percent = c[i].subEvents * 100 / (c.reduce((acc, cur) => acc + cur.subEvents, 0));
let percent2 = c[i].subEvents * 100 / this.sumCount;
let heatColor = this.getColor(percent2, funName);
let w = rect.w * (percent / 100.0);
@ -4163,13 +4159,8 @@ input{
ctx.strokeStyle = `#000000`;
ctx.strokeRect(_x, rect.y + 1, w - 1, rect.h);
let statisticNum = this.getStatistics(c[i]);
let count = this.getCount(c[i]);
this.funcNameSpan.textContent = funName;
if (this.type === 1 || this.type === 2 || this.type === 3) {
this.panel.title = funName + ': [' + count + ' ' + statisticNum + ']';
} else {
this.panel.title = funName + ': [' + statisticNum + ']';
}
this.percentSpan.textContent = statisticNum;
} else {
if (this.mouseState === 'mouseUp') {
@ -4186,7 +4177,7 @@ input{
// 递归绘制子节点
if (c[i].callStack && c[i].callStack.length > 0) {
_rect.y = _rect.y + _rect.h;
this.drawCReverse(c[i].subEvents, [i].callStack, dept + 1, _rect);
this.drawCReverse(c[i].callStack, dept + 1, _rect);
}
}
}

View File

@ -494,12 +494,14 @@ std::vector<pid_t> GetSubthreadIDs(const pid_t pid)
auto tids = GetSubDirs(path);
std::vector<pid_t> res {};
for (auto tidStr : tids) {
if (!tidStr.empty()) {
pid_t tid = static_cast<pid_t>(std::stoul(tidStr, nullptr));
if (tid == pid) {
continue;
}
res.push_back(tid);
}
}
return res;
}