2
0
forked from Ivasoft/DSView

fix: got the block size is error

This commit is contained in:
dreamsourcelabTAI
2023-06-17 14:48:21 +08:00
parent 93e6a02f0e
commit a49331f94a
3 changed files with 22 additions and 2 deletions

View File

@@ -1351,7 +1351,7 @@ uint64_t LogicSnapshot::get_block_size(int block_index)
return LeafBlockSamples / 8;
}
else if (block_index == 0){
samples = min(_ring_sample_count+_loop_offset,
samples = min(_ring_sample_count + (_loop_offset % (uint64_t)LeafBlockSamples),
(uint64_t)LeafBlockSamples) - (_loop_offset % (uint64_t)LeafBlockSamples);
return samples/8;
}

View File

@@ -146,6 +146,10 @@ public:
return _able_free;
}
inline uint64_t get_loop_offset(){
return _loop_offset;
}
private:
bool get_sample_unlock(uint64_t index, int sig_index);
bool get_sample_self(uint64_t index, int sig_index);

View File

@@ -226,6 +226,15 @@ void StoreSession::save_logic(pv::data::LogicSnapshot *logic_snapshot)
_unit_count = logic_snapshot->get_ring_sample_count() / 8 * to_save_probes;
num = logic_snapshot->get_block_num();
/*
dsv_info("total-bytes:%llu, total-sample:%llu, loop-offset:%llu, blocks:%d",
_unit_count,
logic_snapshot->get_ring_sample_count(),
logic_snapshot->get_loop_offset(),
num
);
*/
for(auto s : _session->get_signals())
{
int ch_type = s->get_type();
@@ -264,7 +273,14 @@ void StoreSession::save_logic(pv::data::LogicSnapshot *logic_snapshot)
QFile::remove(_file_name);
return;
}
_units_stored += size;
_units_stored += size;
//dsv_info("read-bytes:%llu, block-size:%llu, block-index:%d-%d", _units_stored, size, ch_index, i);
if (_units_stored > _unit_count){
dsv_err("Read block data error!");
assert(false);
}
if (need_malloc)
free(buf);