DBHandler.cpp 945 B

1234567891011121314151617181920212223242526
  1. #include "DBHandler.hpp"
  2. void DBHandler::readAggregatedStream(uint64_t streamNb, uint64_t alpha, uint64_t offset, uint64_t bytes_per_file, char* rawBits) {
  3. uint64_t fileByteSize = std::min(bytes_per_file, getmaxFileBytesize()-offset);
  4. uint64_t startStream = streamNb*alpha;
  5. uint64_t endStream = std::min(streamNb*alpha + alpha - 1, getNbStream() - 1);
  6. uint64_t paddingStreams = (streamNb*alpha+alpha) >= getNbStream() ? (streamNb*alpha+alpha) - getNbStream() : 0;
  7. #pragma omp critical
  8. {
  9. for (int i=startStream; i <= endStream; i++)
  10. {
  11. openStream(i, offset);
  12. // Just read the file (plus padding for that file)
  13. readStream(i, rawBits + (i % alpha) * fileByteSize, fileByteSize);
  14. closeStream(i);
  15. }
  16. if(paddingStreams !=0)
  17. {
  18. bzero(rawBits + (endStream % alpha) * fileByteSize, fileByteSize*paddingStreams);
  19. }
  20. }
  21. }