mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-17 19:20:46 +00:00
Limit raw data in PRS1/Session YAML to 100 bytes per entry.
This changes the reference output, compared to prior versions, but it runs much faster and doesn't affect user-observable behavior.
This commit is contained in:
parent
1892ceda85
commit
d0150d18ef
@ -1273,6 +1273,7 @@ public:
|
|||||||
m_unit = UNIT;
|
m_unit = UNIT;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const PRS1ParsedEventType PRS1TidalVolumeEvent::TYPE;
|
||||||
|
|
||||||
class PRS1ParsedSettingEvent : public PRS1ParsedValueEvent
|
class PRS1ParsedSettingEvent : public PRS1ParsedValueEvent
|
||||||
{
|
{
|
||||||
@ -1313,7 +1314,8 @@ class T : public P \
|
|||||||
public: \
|
public: \
|
||||||
static const PRS1ParsedEventType TYPE = E; \
|
static const PRS1ParsedEventType TYPE = E; \
|
||||||
T(int start, int ARG) : P(TYPE, start, ARG) {} \
|
T(int start, int ARG) : P(TYPE, start, ARG) {} \
|
||||||
}
|
}; \
|
||||||
|
const PRS1ParsedEventType T::TYPE
|
||||||
#define PRS1_DURATION_EVENT(T, E) _PRS1_EVENT(T, E, PRS1ParsedDurationEvent, duration)
|
#define PRS1_DURATION_EVENT(T, E) _PRS1_EVENT(T, E, PRS1ParsedDurationEvent, duration)
|
||||||
#define PRS1_VALUE_EVENT(T, E) _PRS1_EVENT(T, E, PRS1ParsedValueEvent, value)
|
#define PRS1_VALUE_EVENT(T, E) _PRS1_EVENT(T, E, PRS1ParsedValueEvent, value)
|
||||||
#define PRS1_PRESSURE_EVENT(T, E) _PRS1_EVENT(T, E, PRS1PressureEvent, value)
|
#define PRS1_PRESSURE_EVENT(T, E) _PRS1_EVENT(T, E, PRS1PressureEvent, value)
|
||||||
@ -1345,7 +1347,7 @@ PRS1_VALUE_EVENT(PRS1PressurePulseEvent, EV_PRS1_PP);
|
|||||||
PRS1_VALUE_EVENT(PRS1RERAEvent, EV_PRS1_RERA); // TODO: should this really be a duration event?
|
PRS1_VALUE_EVENT(PRS1RERAEvent, EV_PRS1_RERA); // TODO: should this really be a duration event?
|
||||||
PRS1_VALUE_EVENT(PRS1NonRespondingEvent, EV_PRS1_NRI); // TODO: is this a single event or an index/hour?
|
PRS1_VALUE_EVENT(PRS1NonRespondingEvent, EV_PRS1_NRI); // TODO: is this a single event or an index/hour?
|
||||||
PRS1_VALUE_EVENT(PRS1FlowRateEvent, EV_PRS1_FLOWRATE); // TODO: is this a single event or an index/hour?
|
PRS1_VALUE_EVENT(PRS1FlowRateEvent, EV_PRS1_FLOWRATE); // TODO: is this a single event or an index/hour?
|
||||||
PRS1_VALUE_EVENT(PRS1Test1Event, EV_PRS1_TEST1); // TODO: replace test1/2 event with unknownvalue events and appropriate mapping
|
PRS1_VALUE_EVENT(PRS1Test1Event, EV_PRS1_TEST1);
|
||||||
PRS1_VALUE_EVENT(PRS1Test2Event, EV_PRS1_TEST2);
|
PRS1_VALUE_EVENT(PRS1Test2Event, EV_PRS1_TEST2);
|
||||||
|
|
||||||
//********************************************************************************************
|
//********************************************************************************************
|
||||||
|
@ -125,12 +125,15 @@ static QString ts(qint64 msecs)
|
|||||||
return QDateTime::fromMSecsSinceEpoch(msecs).toString(Qt::ISODate);
|
return QDateTime::fromMSecsSinceEpoch(msecs).toString(Qt::ISODate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString byteList(QByteArray data)
|
static QString byteList(QByteArray data, int limit=-1)
|
||||||
{
|
{
|
||||||
|
int count = data.size();
|
||||||
|
if (limit == -1 || limit > count) limit = count;
|
||||||
QStringList l;
|
QStringList l;
|
||||||
for (int i = 0; i < data.size(); i++) {
|
for (int i = 0; i < limit; i++) {
|
||||||
l.push_back(QString( "%1" ).arg((int) data[i] & 0xFF, 2, 16, QChar('0') ).toUpper());
|
l.push_back(QString( "%1" ).arg((int) data[i] & 0xFF, 2, 16, QChar('0') ).toUpper());
|
||||||
}
|
}
|
||||||
|
if (limit < count) l.push_back("...");
|
||||||
QString s = l.join("");
|
QString s = l.join("");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -180,7 +183,7 @@ void ChunkToYaml(QFile & file, PRS1DataChunk* chunk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// data
|
// data
|
||||||
out << " data: " << byteList(chunk->m_data) << endl;
|
out << " data: " << byteList(chunk->m_data, 100) << endl;
|
||||||
|
|
||||||
// data CRC
|
// data CRC
|
||||||
out << " crc: " << hex << chunk->storedCrc << endl;
|
out << " crc: " << hex << chunk->storedCrc << endl;
|
||||||
|
@ -133,22 +133,26 @@ static QString eventChannel(ChannelID i)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString intList(EventStoreType* data, int count)
|
static QString intList(EventStoreType* data, int count, int limit=-1)
|
||||||
{
|
{
|
||||||
|
if (limit == -1 || limit > count) limit = count;
|
||||||
QStringList l;
|
QStringList l;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < limit; i++) {
|
||||||
l.push_back(QString::number(data[i]));
|
l.push_back(QString::number(data[i]));
|
||||||
}
|
}
|
||||||
|
if (limit < count) l.push_back("...");
|
||||||
QString s = "[ " + l.join(",") + " ]";
|
QString s = "[ " + l.join(",") + " ]";
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString intList(quint32* data, int count)
|
static QString intList(quint32* data, int count, int limit=-1)
|
||||||
{
|
{
|
||||||
|
if (limit == -1 || limit > count) limit = count;
|
||||||
QStringList l;
|
QStringList l;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < limit; i++) {
|
||||||
l.push_back(QString::number(data[i] / 1000));
|
l.push_back(QString::number(data[i] / 1000));
|
||||||
}
|
}
|
||||||
|
if (limit < count) l.push_back("...");
|
||||||
QString s = "[ " + l.join(",") + " ]";
|
QString s = "[ " + l.join(",") + " ]";
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -216,15 +220,15 @@ void SessionToYaml(QString filepath, Session* session)
|
|||||||
out << " data:" << endl;
|
out << " data:" << endl;
|
||||||
out << " min: " << e.Min() << endl;
|
out << " min: " << e.Min() << endl;
|
||||||
out << " max: " << e.Max() << endl;
|
out << " max: " << e.Max() << endl;
|
||||||
out << " raw: " << intList((EventStoreType*) e.m_data.data(), e.count()) << endl;
|
out << " raw: " << intList((EventStoreType*) e.m_data.data(), e.count(), 100) << endl;
|
||||||
if (e.type() != EVL_Waveform) {
|
if (e.type() != EVL_Waveform) {
|
||||||
out << " delta: " << intList((quint32*) e.m_time.data(), e.count()) << endl;
|
out << " delta: " << intList((quint32*) e.m_time.data(), e.count(), 100) << endl;
|
||||||
}
|
}
|
||||||
if (e.hasSecondField()) {
|
if (e.hasSecondField()) {
|
||||||
out << " data2:" << endl;
|
out << " data2:" << endl;
|
||||||
out << " min: " << e.min2() << endl;
|
out << " min: " << e.min2() << endl;
|
||||||
out << " max: " << e.max2() << endl;
|
out << " max: " << e.max2() << endl;
|
||||||
out << " raw: " << intList((EventStoreType*) e.m_data2.data(), e.count()) << endl;
|
out << " raw: " << intList((EventStoreType*) e.m_data2.data(), e.count(), 100) << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user