diff --git a/DSView/pv/data/logicsnapshot.cpp b/DSView/pv/data/logicsnapshot.cpp index 85aa7f42..12d27fdc 100755 --- a/DSView/pv/data/logicsnapshot.cpp +++ b/DSView/pv/data/logicsnapshot.cpp @@ -81,6 +81,7 @@ void LogicSnapshot::init() { std::lock_guard lock(_mutex); init_all(); + _is_file = false; } void LogicSnapshot::init_all() @@ -104,8 +105,9 @@ void LogicSnapshot::clear() init_all(); } + void LogicSnapshot::capture_ended() -{ +{ Snapshot::capture_ended(); uint64_t block_index = _ring_sample_count / LeafBlockSamples; @@ -114,15 +116,29 @@ void LogicSnapshot::capture_ended() if (block_offset != 0) { uint64_t index0 = block_index / RootScale; uint64_t index1 = block_index % RootScale; - int order = 0; + int order = 0; - for(auto& iter:_ch_data) { - if (iter[index0].lbp[index1] == NULL){ - assert(false); + for(auto& iter:_ch_data) { + + // If load from file, process the last channel only + if (_is_file && order != _last_write_order){ + order++; + continue; } + if (_is_file && (_last_index0 != index0 || _last_index1 != index1)){ + // qDebug()<<"deleted index:"<= ScaleSize * _channel_num); if (_sample_count >= _total_sample_count) - return; + return; _src_ptr = logic.data; uint64_t len = logic.length; @@ -400,6 +409,9 @@ void LogicSnapshot::append_split_payload(const sr_datafeed_logic &logic) uint16_t order = logic.order; assert(order < _ch_data.size()); + _last_write_order = order; + _is_file = true; + uint64_t sample_read_num = _sample_cnt[order]; uint64_t write_block_num = _block_cnt[order]; @@ -413,7 +425,7 @@ void LogicSnapshot::append_split_payload(const sr_datafeed_logic &logic) sample_read_num = _total_sample_count; } - _sample_cnt[order] = sample_read_num; + _sample_cnt[order] = sample_read_num; // make buffer while (sample_read_num > write_block_num * LeafBlockSamples) { @@ -431,12 +443,16 @@ void LogicSnapshot::append_split_payload(const sr_datafeed_logic &logic) } _ch_data[order][index0].lbp[index1] = pbuf; + // qDebug()<<"new:"< EdgePair; private: - void init_all(); + void init_all(); public: LogicSnapshot(); @@ -190,8 +190,12 @@ private: uint64_t _block_num; uint8_t _byte_fraction; uint16_t _ch_fraction; - void *_src_ptr; - void *_dest_ptr; + void *_src_ptr; + void *_dest_ptr; + bool _is_file; + int _last_write_order; + uint64_t _last_index0; + uint64_t _last_index1; std::vector _sample_cnt; std::vector _block_cnt;