Skip to content
Snippets Groups Projects
Commit cdd9adf4 authored by Thomas Owen James's avatar Thomas Owen James
Browse files

pass bx_vect to bit_check to avoid expensive copy and append

parent a64753f6
No related branches found
No related tags found
1 merge request!59CMSSW json file
...@@ -20,18 +20,16 @@ StreamProcessor::StreamProcessor(size_t max_size_, bool doZS_, ProcessorType pro ...@@ -20,18 +20,16 @@ StreamProcessor::StreamProcessor(size_t max_size_, bool doZS_, ProcessorType pro
} }
std::vector<uint32_t> bit_check(uint32_t word, uint32_t offset) void bit_check(std::vector<unsigned int>* bx_vect, uint32_t word, uint32_t offset)
{ {
std::vector<uint32_t> vect;
for (uint32_t i = 0; i<32; i++) for (uint32_t i = 0; i<32; i++)
{ {
if (word & 1){ if (word & 1){
vect.push_back(i + offset); bx_vect->push_back(i + offset);
} }
word >>= 1; word >>= 1;
} }
return;
return vect;
} }
StreamProcessor::~StreamProcessor(){ StreamProcessor::~StreamProcessor(){
...@@ -61,8 +59,7 @@ std::vector<unsigned int> StreamProcessor::CountBX(Slice& input){ ...@@ -61,8 +59,7 @@ std::vector<unsigned int> StreamProcessor::CountBX(Slice& input){
orbit_trailer *ot = (orbit_trailer*)(p); orbit_trailer *ot = (orbit_trailer*)(p);
for (unsigned int k = 0; k < (14*8); k++){ // 14*8 = 14 frames, 8 links of orbit trailer containing BX hitmap for (unsigned int k = 0; k < (14*8); k++){ // 14*8 = 14 frames, 8 links of orbit trailer containing BX hitmap
//bxcount += __builtin_popcount(ot->bx_map[k]); //bxcount += __builtin_popcount(ot->bx_map[k]);
std::vector<unsigned int> bx_vect_t = bit_check(ot->bx_map[k], k*32); bit_check(&bx_vect, ot->bx_map[k], k*32);
bx_vect.insert(bx_vect.end(), bx_vect_t.begin(), bx_vect_t.end());
} }
return bx_vect; return bx_vect;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment