Exemplo n.º 1
0
void WriteSWCToPLY(char *filename_trace, char*filename_write)
{
	TraceObject *tobj = new TraceObject();
	tobj->ReadFromSWCFile(filename_trace);
	//tobj->Print(std::cout);
	vtkSmartPointer<vtkPolyData> poly = tobj->GetVTKPolyData();
	poly->GetPointData()->SetScalars(NULL);
	vtkSmartPointer<vtkPolyDataWriter> writer = vtkSmartPointer<vtkPolyDataWriter>::New();
	writer->SetFileName(filename_write);
	writer->SetFileTypeToBinary();
	writer->SetInputData(poly);
	writer->Write();
	delete tobj;
	

}
Exemplo n.º 2
0
// make sure that a valid object is set, at least dummy with empty name
void CachegrindLoader::ensureObject()
{
    if (currentObject) return;

    currentObject = _data->object(_emptyString);
    currentPartObject = currentObject->partObject(_part);
}
Exemplo n.º 3
0
TraceObject* CachegrindLoader::compressedObject(const QString& name)
{
    if ((name[0] != '(') || !name[1].isDigit()) return _data->object(checkUnknown(name));

    // compressed format using _objectVector
    int p = name.indexOf(')');
    if (p<2) {
        error(QStringLiteral("Invalid compressed ELF object ('%1')").arg(name));
        return 0;
    }
    int index = name.midRef(1, p-1).toInt();
    TraceObject* o = 0;
    p++;
    while((name.length()>p) && name.at(p).isSpace()) p++;
    if (name.length()>p) {
        if (_objectVector.size() <= index) {
            int newSize = index * 2;
#if TRACE_LOADER
            qDebug() << " CachegrindLoader: objectVector enlarged to "
                     << newSize;
#endif
            _objectVector.resize(newSize);
        }

        QString realName = checkUnknown(name.mid(p));
        o = (TraceObject*) _objectVector.at(index);
        if (o && (o->name() != realName)) {
            error(QStringLiteral("Redefinition of compressed ELF object index %1 (was '%2') to %3")
                  .arg(index).arg(o->name()).arg(realName));
        }

        o = _data->object(realName);
        _objectVector.replace(index, o);
    }
    else {
        if ((_objectVector.size() <= index) ||
            ( (o=(TraceObject*)_objectVector.at(index)) == 0)) {
            error(QStringLiteral("Undefined compressed ELF object index %1").arg(index));
            return 0;
        }
    }

    return o;
}
Exemplo n.º 4
0
void CachegrindLoader::setCalledObject(const QString& name)
{
    currentCalledObject = compressedObject(name);

    if (!currentCalledObject) {
        error(QStringLiteral("Invalid specification of called ELF object, setting to unknown"));

        currentCalledObject = _data->object(_emptyString);
    }

    currentCalledPartObject = currentCalledObject->partObject(_part);
}
Exemplo n.º 5
0
void CachegrindLoader::setObject(const QString& name)
{
  currentObject = compressedObject(name);
  if (!currentObject) {
	  error(QString("Invalid ELF object specification, setting to unknown"));

    currentObject = _data->object(_emptyString);
  }

  currentPartObject = currentObject->partObject(_part);
  currentFunction = 0;
  currentPartFunction = 0;
}
Exemplo n.º 6
0
void FunctionListModel::resetModelData(TraceData *data,
                                       TraceCostItem *group, QString filterString,
                                       EventType * eventType)
{
    _eventType = eventType;

    if (!group) {
        _list.clear();
        _groupType = ProfileContext::Function;
        if (data) {
            TraceFunctionMap::iterator i = data->functionMap().begin();
            while (i != data->functionMap().end()) {
                _list.append(&(i.value()));
                ++i;
            }
            foreach(TraceFunction* f, data->functionCycles())
                _list.append(f);
        }
    }
    else {
        _groupType = group->type();
        switch(_groupType) {
        case ProfileContext::Object:
        {
            TraceObject* o = dynamic_cast<TraceObject*>(group);
            Q_ASSERT(o != 0);
            _list = o->functions();
        }
            break;

        case ProfileContext::Class:
        {
            TraceClass* c = dynamic_cast<TraceClass*>(group);
            Q_ASSERT(c != 0);
            _list = c->functions();
        }
            break;

        case ProfileContext::File:
        {
            TraceFile* f = dynamic_cast<TraceFile*>(group);
            Q_ASSERT(f != 0);
            _list = f->functions();
        }
            break;

        case ProfileContext::FunctionCycle:
        {
            TraceFunctionCycle* c = dynamic_cast<TraceFunctionCycle*>(group);
            Q_ASSERT(c != 0);
            _list = c->members();
        }
            break;

        default:
            _list.clear();
            break;
        }
    }

    _filterString = filterString;
    _filter = QRegExp(_filterString, Qt::CaseInsensitive, QRegExp::Wildcard);

    computeFilteredList();
    computeTopList();
}