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

added NOrbitsPerPacket parameter

parent e01a0138
No related branches found
No related tags found
1 merge request!59CMSSW json file
...@@ -91,6 +91,10 @@ public: ...@@ -91,6 +91,10 @@ public:
bool getOutputForceWrite() const { bool getOutputForceWrite() const {
return (true ? vmap.at("output_force_write") == "yes" : false); return (true ? vmap.at("output_force_write") == "yes" : false);
} }
uint32_t getNOrbitsPerDMAPacket() const {
std::string v = vmap.at("NOrbitsPerDMAPacket");
return boost::lexical_cast<uint32_t>(v.c_str());
}
uint32_t getNumThreads() const { uint32_t getNumThreads() const {
std::string v = vmap.at("threads"); std::string v = vmap.at("threads");
......
...@@ -10,5 +10,6 @@ struct ctrl { ...@@ -10,5 +10,6 @@ struct ctrl {
bool output_force_write; bool output_force_write;
uint64_t max_file_size; uint64_t max_file_size;
int packets_per_report; int packets_per_report;
int n_orbits_per_dma_packet;
}; };
#endif #endif
...@@ -7,12 +7,13 @@ ...@@ -7,12 +7,13 @@
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
StreamProcessor::StreamProcessor(size_t max_size_, bool doZS_, ProcessorType processorType_) : StreamProcessor::StreamProcessor(size_t max_size_, bool doZS_, ProcessorType processorType_, uint32_t nOrbitsPerDMAPacket_) :
tbb::filter(parallel), tbb::filter(parallel),
max_size(max_size_), max_size(max_size_),
nbPackets(0), nbPackets(0),
doZS(doZS_), doZS(doZS_),
processorType(processorType_) processorType(processorType_),
nOrbitsPerDMAPacket(nOrbitsPerDMAPacket_)
{ {
LOG(TRACE) << "Created transform filter at " << static_cast<void*>(this); LOG(TRACE) << "Created transform filter at " << static_cast<void*>(this);
myfile.open ("example.txt"); myfile.open ("example.txt");
...@@ -41,7 +42,7 @@ StreamProcessor::~StreamProcessor(){ ...@@ -41,7 +42,7 @@ StreamProcessor::~StreamProcessor(){
bool StreamProcessor::CheckFrameMultBlock(uint32_t inputSize){ bool StreamProcessor::CheckFrameMultBlock(uint32_t inputSize){
int bsize = sizeof(block1); int bsize = sizeof(block1);
if((inputSize-20*constants::orbit_trailer_size - 32*20 -32)%bsize!=0){ if((inputSize-nOrbitsPerDMAPacket*constants::orbit_trailer_size - 32*nOrbitsPerDMAPacket -32)%bsize!=0){
LOG(WARNING) LOG(WARNING)
<< "Frame size not a multiple of block size. Will be skipped. Frame size = " << "Frame size not a multiple of block size. Will be skipped. Frame size = "
<< inputSize << ", block size = " << bsize; << inputSize << ", block size = " << bsize;
...@@ -76,7 +77,6 @@ uint32_t StreamProcessor::FillOrbit(Slice& input, Slice& out, std::vector<unsign ...@@ -76,7 +77,6 @@ uint32_t StreamProcessor::FillOrbit(Slice& input, Slice& out, std::vector<unsign
char* q = out.begin(); // +32 to account for orbit header char* q = out.begin(); // +32 to account for orbit header
uint32_t relbx = 0; uint32_t relbx = 0;
uint32_t counts = 0; uint32_t counts = 0;
std::cout << "here1 "<< std::endl;
while(relbx < bx_vect->size()){ while(relbx < bx_vect->size()){
block1 *bl = (block1*)(p); block1 *bl = (block1*)(p);
if(bl->orbit[0]==constants::beefdead){break;} if(bl->orbit[0]==constants::beefdead){break;}
...@@ -181,7 +181,6 @@ Slice* StreamProcessor::process(Slice& input, Slice& out) ...@@ -181,7 +181,6 @@ Slice* StreamProcessor::process(Slice& input, Slice& out)
if( *dma_trailer_word == constants::deadbeef){ if( *dma_trailer_word == constants::deadbeef){
endofpacket = true; endofpacket = true;
out.set_end(q); out.set_end(q);
std::cout << "counts " << counts << std::endl;
out.set_counts(counts); out.set_counts(counts);
return &out; return &out;
} }
......
...@@ -16,7 +16,7 @@ public: ...@@ -16,7 +16,7 @@ public:
enum class ProcessorType { PASS_THROUGH, GMT }; enum class ProcessorType { PASS_THROUGH, GMT };
public: public:
StreamProcessor(size_t max_size_, bool doZS_, ProcessorType processorType_); StreamProcessor(size_t max_size_, bool doZS_, ProcessorType processorType_, uint32_t nOrbitsPerDMAPacket_);
void* operator()( void* item )/*override*/; void* operator()( void* item )/*override*/;
~StreamProcessor(); ~StreamProcessor();
...@@ -31,6 +31,7 @@ private: ...@@ -31,6 +31,7 @@ private:
size_t max_size; size_t max_size;
uint64_t nbPackets; uint64_t nbPackets;
bool doZS; bool doZS;
uint32_t nOrbitsPerDMAPacket;
ProcessorType processorType; ProcessorType processorType;
}; };
......
...@@ -25,6 +25,8 @@ dma_number_of_packet_buffers:1000 ...@@ -25,6 +25,8 @@ dma_number_of_packet_buffers:1000
# Print report each N packets, use 0 to disable # Print report each N packets, use 0 to disable
packets_per_report:200000 packets_per_report:200000
# number of orbits per DMA packet, in decimal
NOrbitsPerDMAPacket:1
## Extra settings for "filedma" input ## Extra settings for "filedma" input
......
...@@ -25,6 +25,8 @@ dma_number_of_packet_buffers:1000 ...@@ -25,6 +25,8 @@ dma_number_of_packet_buffers:1000
# Print report each N packets, use 0 to disable # Print report each N packets, use 0 to disable
packets_per_report:200000 packets_per_report:200000
# number of orbits per DMA packet, in decimal
NOrbitsPerDMAPacket:20
## Extra settings for "filedma" input ## Extra settings for "filedma" input
......
...@@ -66,7 +66,7 @@ int run_pipeline( int nbThreads, ctrl& control, config& conf ) ...@@ -66,7 +66,7 @@ int run_pipeline( int nbThreads, ctrl& control, config& conf )
// Create reformatter and add it to the pipeline // Create reformatter and add it to the pipeline
// TODO: Created here so we are not subject of scoping, fix later... // TODO: Created here so we are not subject of scoping, fix later...
StreamProcessor stream_processor(packetBufferSize, conf.getDoZS(), conf.getProcessorType()); StreamProcessor stream_processor(packetBufferSize, conf.getDoZS(), conf.getProcessorType(), conf.getNOrbitsPerDMAPacket());
if ( conf.getEnableStreamProcessor() ) { if ( conf.getEnableStreamProcessor() ) {
pipeline.add_filter( stream_processor ); pipeline.add_filter( stream_processor );
} }
...@@ -124,7 +124,7 @@ int main( int argc, char* argv[] ) { ...@@ -124,7 +124,7 @@ int main( int argc, char* argv[] ) {
control.max_file_size = conf.getOutputMaxFileSize();//in Bytes control.max_file_size = conf.getOutputMaxFileSize();//in Bytes
control.packets_per_report = conf.getPacketsPerReport(); control.packets_per_report = conf.getPacketsPerReport();
control.output_force_write = conf.getOutputForceWrite(); control.output_force_write = conf.getOutputForceWrite();
control.n_orbits_per_dma_packet = conf.getNOrbitsPerDMAPacket();
// Firmware needs at least 1MB buffer for DMA // Firmware needs at least 1MB buffer for DMA
if (conf.getDmaPacketBufferSize() < 1024*1024) { if (conf.getDmaPacketBufferSize() < 1024*1024) {
LOG(ERROR) << "dma_packet_buffer_size must be at least 1048576 bytes (1MB), but " << conf.getDmaPacketBufferSize() << " bytes was given. Check the configuration file."; LOG(ERROR) << "dma_packet_buffer_size must be at least 1048576 bytes (1MB), but " << conf.getDmaPacketBufferSize() << " bytes was given. Check the configuration file.";
......
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