예제 #1
0
void RowCollection<Group,Hash>::getWholeRow(size_t rowId, Items& items, bool separateNull, uint32_t attrId, Items* pNullItems) {
    assert(_mode==RowCollectionModeRead);
    assert(separateNull || (pNullItems==NULL));
    assert(items.empty());
    if (pNullItems!=NULL) {
        assert(pNullItems->empty());
    }

    boost::scoped_ptr<MyRowIterator> rowIterator(openRow(rowId));
    items.reserve(_counts[rowId]);
    TypeId strType = _attributes[attrId].getType();
    DoubleFloatOther type = getDoubleFloatOther(strType);
    while (!rowIterator->end()) {
        vector<Value> item(_attributes.size());
        rowIterator->getItem(item);
        if (separateNull && isNullOrNan(item[attrId], type)) {
            if (pNullItems!=NULL) {
                pNullItems->push_back(item);
            }
        } else {
            items.push_back(item);
        }
        ++(*rowIterator);
    }
}
예제 #2
0
void FillTreeClass<T>::setTreeInternal1(T& _safelocker, Items& _items, ThreadedItems& _topLevelItems, ::profiler::timestamp_t& _beginTime, const unsigned int _blocksNumber, const ::profiler::thread_blocks_tree_t& _blocksTree, bool _colorizeRows)
{
    _items.reserve(_blocksNumber + _blocksTree.size()); // _blocksNumber does not include Thread root blocks

    ::profiler::timestamp_t finishtime = 0;
    for (const auto& threadTree : _blocksTree)
    {
        const auto node_block = blocksTree(threadTree.second.children.front()).node;
        const auto startTime = node_block->begin();
        const auto endTime = node_block->end();

        if (_beginTime > startTime)
            _beginTime = startTime;

        if (finishtime < endTime)
            finishtime = endTime;
    }

    //const QSignalBlocker b(this);
    const auto u_thread = ::profiler_gui::toUnicode("thread");
    int i = 0;
    const int total = static_cast<int>(_blocksTree.size());
    for (const auto& threadTree : _blocksTree)
    {
        if (_safelocker.interrupted())
            break;

        const auto& root = threadTree.second;
        auto item = new EasyTreeWidgetItem();

        QString threadName;
        if (root.got_name())
        {
            QString rootname(::profiler_gui::toUnicode(root.name()));
            if (rootname.contains(u_thread, Qt::CaseInsensitive))
                threadName = ::std::move(QString("%1 %2").arg(rootname).arg(root.thread_id));
            else
                threadName = ::std::move(QString("%1 Thread %2").arg(rootname).arg(root.thread_id));
        }
        else
        {
            threadName = ::std::move(QString("Thread %1").arg(root.thread_id));
        }

        item->setText(COL_NAME, threadName);

        ::profiler::timestamp_t duration = 0;
        if (!root.children.empty())
            duration = blocksTree(root.children.back()).node->end() - blocksTree(root.children.front()).node->begin();

        item->setTimeSmart(COL_DURATION, duration);
        item->setBackgroundColor(::profiler_gui::SELECTED_THREAD_BACKGROUND);
        item->setTextColor(::profiler_gui::SELECTED_THREAD_FOREGROUND);

        //_items.push_back(item);

        item->setTimeSmart(COL_SELF_DURATION, root.active_time);

        ::profiler::timestamp_t children_duration = 0;
        const auto children_items_number = FillTreeClass<T>::setTreeInternal(_safelocker, _items, _beginTime, root.children, item, nullptr, item, _beginTime, finishtime + 1000000000ULL, false, children_duration, _colorizeRows);

        if (children_items_number > 0)
        {
            //total_items += children_items_number + 1;
            //addTopLevelItem(item);
            //m_roots[threadTree.first] = item;
            _topLevelItems.emplace_back(root.thread_id, item);
        }
        else
        {
            //_items.pop_back();
            delete item;
        }

        _safelocker.setProgress((100 * ++i) / total);
    }

    _safelocker.setDone();
    //return total_items;
}