11#include "QHyodaPapi.h"
12#include "QHyodaTool.h"
14#include "ui_hyodaPapi.h"
26QHyodaPapi::QHyodaPapi(
QHyodaTool *QTool):tool(QTool){
27 qDebug() <<
"[QHyodaPapi::QHyodaPapi]";
31QHyodaPapi::~QHyodaPapi(){
32 qDebug() <<
"[QHyodaPapi::~QHyodaPapi]";
39void QHyodaPapi::ini(){
40 QVBoxLayout *profilerLayout = tool->papi->profilerLayout;
41 if (profilerLayout->count()==0){
42 for(
int i=0;i<max_nb_func_to_profile;i+=1){
43 QGroupBox *box =
new QGroupBox;
44 QVBoxLayout *vbox =
new QVBoxLayout;
45 QProgressBar *bar =
new QProgressBar;
48 profilerLayout->addWidget(box);
57void QHyodaPapi::update(QByteArray *read){
58 QVBoxLayout *profilerLayout = tool->papi->profilerLayout;
61 if (profilerLayout->count()==0) ini();
66 const char *data=read->data();
67 const qint64 *pkt=(qint64*)&data[0];
68 const qint64 size=pkt[0];
69 const int capacity=read->capacity();
74 if (capacity!=size<<3)
75 qFatal(
"[QHyodaPapi::update] capacity missmatch size !");
77 const qint64 total_event = pkt[1];
78 const qint64 total_fp = pkt[2];
79 const qint64 m_period = pkt[3];
80 const qint64 index = pkt[4];
88 char demangled_func_name[8192];
89 for(
int i=0;i<index;i+=1){
90 const qint64 nb_event = pkt[of7++];
91 const qint64 total_percent = pkt[of7++];
92 const qint64 m_counters_0 = pkt[of7++];
93 const qint64 m_counters_1 = pkt[of7++];
94 const qint64 m_counters_2 = pkt[of7++];
95 const qint64 mx = pkt[of7++];
96 const char* func_name = (
char*)&pkt[of7];
108 buf = abi::__cxa_demangle(func_name,demangled_func_name,&len,&dstatus);
110 if (!buf) memcpy(&demangled_func_name[0],func_name,strlen(func_name)+1);
115 QGroupBox *box =
static_cast<QGroupBox*
>(profilerLayout->itemAt(i)->widget());
117 if (box->title() != demangled_func_name) box->setTitle(demangled_func_name);
119 QProgressBar *bar = box->findChild<QProgressBar*>();
120 int value = (nb_event*100)/total_event;
122 if (bar->value() != value) bar->setValue(value);
128 if (i==max_nb_func_to_profile-1){
Integer len(const char *s)
Retourne la longueur de la chaîne s.