FACT++  1.0
bool zofits::CompressBuffer ( const CompressionTarget target)
inlineprotected

Compress a given buffer based on the target. This is the method executed by the threads

Parameters
targetthe struct hosting the parameters of the compression
Returns
number of bytes of the compressed data, or always 1 when used by the Queues

Definition at line 692 of file zofits.h.

References zofits::CompressionTarget::catalog_entry, zofits::WriteTarget::data, i, zofits::CompressionTarget::num_rows, zofits::CompressionTarget::src, zofits::CompressionTarget::target, and zofits::CompressionTarget::transposed_src.

Referenced by SetNumThreads().

693  {
694  //Can't get this to work in the thread. Printed the adresses, and they seem to be correct.
695  //Really do not understand what's wrong...
696  //calibrate data if required
697  const uint32_t thisRoundNumRows = (target.num_rows%fNumRowsPerTile) ? target.num_rows%fNumRowsPerTile : fNumRowsPerTile;
698  for (uint32_t i=0;i<thisRoundNumRows;i++)
699  {
700  char* target_location = target.src.get() + fRealRowWidth*i;
701  DrsOffsetCalibrate(target_location);
702  }
703 #ifdef __EXCEPTIONS
704  try
705  {
706 #endif
707  //transpose the original data
708  copyTransposeTile(target.src.get(), target.transposed_src.get(), target.num_rows);
709 
710  //compress the buffer
711  const uint64_t compressed_size = compressBuffer(target.target.data.get(), target.transposed_src.get(), target.num_rows, target.catalog_entry);
712 
713  //post the result to the writing queue
714  //get a copy so that it becomes non-const
715  fWriteToDiskQueue.emplace(target.target, compressed_size);
716 
717 #ifdef __EXCEPTIONS
718  }
719  catch (...)
720  {
721  fThreadsException = std::current_exception();
722  if (fNumQueues == 0)
723  std::rethrow_exception(fThreadsException);
724  }
725 #endif
726 
727  return true;
728  }
int32_t fNumQueues
Current number of threads that will be used by this object.
Definition: zofits.h:969
uint32_t fNumRowsPerTile
Number of rows per tile.
Definition: zofits.h:980
int i
Definition: db_dim_client.c:21
virtual void DrsOffsetCalibrate(char *)
Applies the DrsOffsets calibration to the data. Does nothing as zofits knows nothing about drsoffsets...
Definition: zofits.h:287
Queue< WriteTarget, QueueMin< WriteTarget > > fWriteToDiskQueue
Writing queue (=thread)
Definition: zofits.h:974
void copyTransposeTile(const char *src, char *dest, uint32_t num_rows)
Definition: zofits.h:851
uint64_t compressBuffer(char *dest, char *src, uint32_t num_rows, CatalogRow &catalog_row)
Compress a given buffer based on its source and destination.
Definition: zofits.h:765
uint32_t fRealRowWidth
Width in bytes of one uncompressed row.
Definition: zofits.h:1006
std::exception_ptr fThreadsException
exception pointer to store exceptions coming from the threads
Definition: zofits.h:1010

+ Here is the caller graph for this function: