示例#1
0
TriggerView::TriggerView(QWidget *parent, Node * node, int timeRange, int timeInterval, double zoomRatio, bool gotoThread)
    : QWidget(parent)
{
    backupnode=node;
    timerange=timeRange;
    timeinterval=timeInterval;
	zoomratio=zoomRatio;

    nodetag=QString("%1_%2_%3").arg(node->getNodeType()).arg(node->getNodeClass()).arg(node->getNodeName());
    QVBoxLayout * layout=new QVBoxLayout();
	pulse=new QLabel;
    layout->addWidget(pulse);
	pulse->setFixedWidth(int(timerange*zoomratio+0.5)+1);
    this->setLayout(layout);

    bool flag=1;
    if(gotoThread)
    {
        flag&=bool(connect(node,SIGNAL(nodeTriggerTimeSignal(QDateTime, Node::NodeTriggerState)),this,SLOT(nodeTriggerTimeSlot(QDateTime, Node::NodeTriggerState)),Qt::BlockingQueuedConnection));
        //flag&=bool(connect(node,SIGNAL(nodeTriggerTimeSignal(QDateTime, Node::NodeTriggerState)),this,SLOT(nodeTriggerTimeSlot(QDateTime, Node::NodeTriggerState))));
    }
    else
    {
        flag&=bool(connect(node,SIGNAL(nodeTriggerTimeSignal(QDateTime, Node::NodeTriggerState)),this,SLOT(nodeTriggerTimeSlot(QDateTime, Node::NodeTriggerState))));
    }
    flag&=bool(connect(parent,SIGNAL(drawSignal(QDateTime)),this,SLOT(drawSlot(QDateTime))));

    int width=int(timerange*zoomratio+0.5)+1;
    int height=MONITORSIZE;
    QFontMetrics fm=pulse->fontMetrics();

	int i,n;
    QImage image(width,height,QImage::Format_ARGB32);
    image.fill(32);
    QPainter painter;
    painter.begin(&image);

    n=timerange/timeinterval;
    painter.setPen(QColor(0,0,0,128));
    painter.drawText(0,fm.height(),QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss:zzz"));
    painter.drawLine(0,fm.height(),width,fm.height());
    painter.drawLine(0,height-fm.height(),width,height-fm.height());
    for(i=0;i<=n;i++)
    {
        QString timestamp=QString("%1ms").arg(i*(timeinterval));
		painter.drawLine(i*(int(timeinterval*zoomratio+0.5)),fm.height(),i*(int(timeinterval*zoomratio+0.5)),height-fm.height());
        painter.drawText(i*(int(timeinterval*zoomratio+0.5))+0.5,height,timestamp);
    }
	painter.end();
    pulse->setPixmap(QPixmap::fromImage(image));
}
示例#2
0
TraceView::TraceView(QObject *parent, Data *data)
{
    // Initialize properties
    this->parent = parent;
    this->data = data;
    this->checkedTaskList = new QStringList;
    this->filterList = new QList <FtraceData *>();
    this->pageSize = 200;


    // Set selectMode
    //-------------------------------------------------------------------------------------------------

    this->selectModeGroupBox = new QGroupBox("Select Tracing Mode");

    this->ftraceRadioButton = new QRadioButton("Ftrace");
    this->ftraceRadioButton->setChecked(true);
    this->eventTracerRadioButton = new QRadioButton("Event Tracer");

    this->radioButtonGroup = new QButtonGroup;
    this->radioButtonGroup->addButton(this->ftraceRadioButton);
    this->radioButtonGroup->addButton(this->eventTracerRadioButton);
    connect(this->radioButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(changeButtonSlot(int)));

    QHBoxLayout *radioButtonLayout = new QHBoxLayout;
    radioButtonLayout->addWidget(this->ftraceRadioButton);
    radioButtonLayout->addWidget(this->eventTracerRadioButton);

    this->startButton = new QPushButton;
    this->startButton->setText("FTRACE START");
    connect(this->startButton, SIGNAL(clicked()), this->data->traceThread, SLOT(startReadingSlot()));
    connect(this->startButton, SIGNAL(clicked()), this, SLOT(showStartDialogSlot()));

    this->optionButton = new QPushButton;
    this->optionButton->setText("FTRACE OPTION");
    connect(this->optionButton, SIGNAL(clicked()), this, SLOT(setFtraceOptionSlot()));

    this->taskPlotButton = new QPushButton;
    this->taskPlotButton->setText("TASK PLOT");
    this->taskPlotButton->setEnabled(false);

    QHBoxLayout *hBoxLayout = new QHBoxLayout;
    hBoxLayout->addWidget(this->startButton);
    hBoxLayout->addWidget(this->optionButton);
    hBoxLayout->addWidget(this->taskPlotButton);

    QVBoxLayout *selectModeLayout = new QVBoxLayout;
    selectModeLayout->addLayout(radioButtonLayout);
    selectModeLayout->addLayout(hBoxLayout);

    this->selectModeGroupBox->setLayout(selectModeLayout);

    //-------------------------------------------------------------------------------------------------

    // Set Graph View
    //-------------------------------------------------------------------------------------------------

    this->graphView = new GraphView(this->parent, this->data);
    connect(this->data, SIGNAL(finishParseSignal()), this->graphView, SLOT(drawSlot()));
    connect(this, SIGNAL(drawTaskSignal()), this->graphView, SLOT(drawTaskSlot()));

    //-------------------------------------------------------------------------------------------------

    // Set Data Filter
    //-------------------------------------------------------------------------------------------------

    this->pageLabel = new QLabel("Page :");
    this->pageComboBox = new QComboBox;
    this->pageComboBox->setEnabled(false);

    this->cpuLabel = new QLabel("CPU # :");
    this->cpuComboBox = new QComboBox;
    this->cpuComboBox->setEnabled(false);
    this->cpuComboBox->addItems(QStringList() << "All CPU" << "0" << "1" << "2" << "3");

    this->taskLabel = new QLabel("Task :");
    this->taskComboBox = new QComboBox;
    this->taskComboBox->setEnabled(false);
    this->taskComboBox->addItem("All Tasks");

    QHBoxLayout *filterLayout = new QHBoxLayout;
    filterLayout->addWidget(this->pageLabel);
    filterLayout->addWidget(this->pageComboBox);
    filterLayout->addWidget(this->cpuLabel);
    filterLayout->addWidget(this->cpuComboBox);
    filterLayout->addWidget(this->taskLabel);
    filterLayout->addWidget(this->taskComboBox);

    //-------------------------------------------------------------------------------------------------

    // Set Data List
    //-------------------------------------------------------------------------------------------------
    this->traceViewModel = new QStandardItemModel;
    this->traceViewModel->setHorizontalHeaderLabels(QStringList() << "#" << "Task" << "PID" << "CPU" << "Latency" << "Time Stamp" << "Function");
    this->traceViewProxyModel = new QSortFilterProxyModel;
    this->traceViewProxyModel->setSourceModel(this->traceViewModel);

    this->traceViewTreeView = new QTreeView;
    this->traceViewTreeView->setRootIsDecorated(false);
    this->traceViewTreeView->setAlternatingRowColors(true);
    this->traceViewTreeView->setModel(this->traceViewProxyModel);
    this->traceViewTreeView->setSortingEnabled(true);

    QVBoxLayout *dataListLayout = new QVBoxLayout;
    dataListLayout->addLayout(filterLayout);
    dataListLayout->addWidget(this->traceViewTreeView);
    QWidget *dataListWidget = new QWidget;
    dataListWidget->setLayout(dataListLayout);

    //-------------------------------------------------------------------------------------------------

    // Splitter & Main

    QSplitter *splitter = new QSplitter;
    splitter->setOrientation(Qt::Vertical);
    splitter->addWidget(this->graphView);
    splitter->addWidget(dataListWidget);

    QGridLayout *gridLayout = new QGridLayout;
    gridLayout->addWidget(this->selectModeGroupBox);
    gridLayout->addWidget(splitter);
    setLayout(gridLayout);
}
示例#3
0
TriggerView::~TriggerView()
{
    bool flag=1;
    flag&=bool(disconnect(backupnode,SIGNAL(nodeTriggerTimeSignal(QDateTime, Node::NodeTriggerState)),this,SLOT(nodeTriggerTimeSlot(QDateTime, Node::NodeTriggerState))));
    flag&=bool(disconnect(backupnode,SIGNAL(drawSignal(QDateTime)),this,SLOT(drawSlot(QDateTime))));
}