当前位置: 首页>>代码示例>>C++>>正文


C++ TraceData::subCost方法代码示例

本文整理汇总了C++中TraceData::subCost方法的典型用法代码示例。如果您正苦于以下问题:C++ TraceData::subCost方法的具体用法?C++ TraceData::subCost怎么用?C++ TraceData::subCost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TraceData的用法示例。


在下文中一共展示了TraceData::subCost方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update

void CostListItem::update()
{
  if (!_costItem) return;
  TraceData* d = _costItem->data();

  double total = d->subCost(_eventType);
  if (total == 0.0) {
    setText(0, QString("---"));
    setIcon(0, QPixmap());
    return;
  }

  _pure = _costItem->subCost(_eventType);
  double pure  = 100.0 * _pure / total;
  QString str;
  if (GlobalConfig::showPercentage())
    str = QString("%1").arg(pure, 0, 'f', GlobalConfig::percentPrecision());
  else
    str = _costItem->prettySubCost(_eventType);

  if (_skipped) {
    // special handling for skip entries...
    setText(0, QString("< %1").arg(str));
    return;
  }

  setText(0, str);
  setIcon(0, costPixmap(_eventType, _costItem, total, false));
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:29,代码来源:costlistitem.cpp

示例2: update

void CostTypeItem::update()
{
  TraceData* d = _costItem ? _costItem->data() : 0;
  double total = d ? ((double)d->subCost(_costType)) : 0.0;

  if (total == 0.0) {
    setText(1, "-");
    setPixmap(1, QPixmap());
    setText(2, "-");
    setPixmap(2, QPixmap());
    return;
  }

  TraceFunction* f = (_costItem->type()==TraceCost::Function) ?
                     (TraceFunction*)_costItem : 0;

  TraceCost* selfTotalCost = f ? f->data() : d;
  if (f && Configuration::showExpanded()) {
      switch(_groupType) {
      case TraceCost::Object: selfTotalCost = f->object(); break;
      case TraceCost::Class:  selfTotalCost = f->cls(); break;
      case TraceCost::File:   selfTotalCost = f->file(); break;
      case TraceCost::FunctionCycle: selfTotalCost = f->cycle(); break;
      default: break;
      }
  }
  if (_costItem->type()==TraceCost::FunctionCycle) {
      f = (TraceFunction*)_costItem;
      selfTotalCost = f->data();
  }

  double selfTotal = selfTotalCost->subCost(_costType);

  // for all cost items there's a self cost
  _pure = _costItem ? _costItem->subCost(_costType) : SubCost(0);
  double pure  = 100.0 * _pure / selfTotal;
  if (Configuration::showPercentage()) {
    setText(2, QString("%1")
            .arg(pure, 0, 'f', Configuration::percentPrecision()));
  }
  else
    setText(2, _costItem->prettySubCost(_costType));

  setPixmap(2, costPixmap(_costType, _costItem, selfTotal, false));

  if (!f) {
    setText(1, "-");
    setPixmap(1, QPixmap());
    return;
  }

  _sum = f->inclusive()->subCost(_costType);
  double sum  = 100.0 * _sum / total;
  if (Configuration::showPercentage()) {
    setText(1, QString("%1")
            .arg(sum, 0, 'f', Configuration::percentPrecision()));
  }
  else
    setText(1, _sum.pretty());

  setPixmap(1, costPixmap(_costType, f->inclusive(), total, false));
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:62,代码来源:costtypeitem.cpp

示例3: update

void EventTypeItem::update()
{
    TraceData* d = _costItem ? _costItem->data() : 0;
    double total = d ? ((double)d->subCost(_eventType)) : 0.0;

    if (total == 0.0) {
        setText(1, "-");
        setIcon(1, QIcon());
        setText(2, "-");
        setIcon(2, QIcon());
        return;
    }

    TraceFunction* f = (_costItem && _costItem->type()==ProfileContext::Function) ?
                       (TraceFunction*)_costItem : 0;

    ProfileCostArray* selfTotalCost = f ? f->data() : d;
    if (f && GlobalConfig::showExpanded()) {
        ProfileCostArray* parent = 0;
        switch(_groupType) {
        case ProfileContext::Object:
            parent = f->object();
            break;
        case ProfileContext::Class:
            parent = f->cls();
            break;
        case ProfileContext::File:
            parent = f->file();
            break;
        case ProfileContext::FunctionCycle:
            parent = f->cycle();
            break;
        default:
            break;
        }
        if (parent) selfTotalCost = parent;
    }
    if (_costItem && _costItem->type()==ProfileContext::FunctionCycle) {
        f = (TraceFunction*)_costItem;
        selfTotalCost = f->data();
    }

    double selfTotal = selfTotalCost->subCost(_eventType);

    // for all cost items there is a self cost
    _pure = _costItem ? _costItem->subCost(_eventType) : SubCost(0);
    double pure  = 100.0 * _pure / selfTotal;
    if (GlobalConfig::showPercentage()) {
        setText(2, QString("%1")
                .arg(pure, 0, 'f', GlobalConfig::percentPrecision()));
    }
    else if (_costItem)
        setText(2, _costItem->prettySubCost(_eventType));

    setIcon(2, QIcon(costPixmap(_eventType, _costItem, selfTotal, false)));

    if (!f) {
        setText(1, "-");
        setIcon(1, QIcon());
        return;
    }

    _sum = f->inclusive()->subCost(_eventType);
    double sum  = 100.0 * _sum / total;
    if (GlobalConfig::showPercentage()) {
        setText(1, QString("%1")
                .arg(sum, 0, 'f', GlobalConfig::percentPrecision()));
    }
    else
        setText(1, _sum.pretty());

    setIcon(1, QIcon(costPixmap(_eventType, f->inclusive(), total, false)));
}
开发者ID:Zekom,项目名称:kcachegrind,代码行数:73,代码来源:eventtypeitem.cpp


注:本文中的TraceData::subCost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。