Changeset 17239 for trunk


Ignore:
Timestamp:
10/17/13 15:33:53 (11 years ago)
Author:
lyard
Message:
zofits with extra default values setters
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mcore/zofits.h

    r17237 r17239  
    6161        /// @param rowPerTile how many rows will be grouped together in a single tile
    6262        /// @param maxUsableMem how many bytes of memory can be used by the compression buffers
    63         zofits(uint32_t numTiles=1000,
    64                uint32_t rowPerTile=100,
    65                uint64_t maxUsableMem=0) : ofits(),
    66                                           fMemPool(0, maxUsableMem),
    67                                           fWriteToDiskQueue(bind(&zofits::WriteBufferToDisk, this, placeholders::_1), false)
     63        zofits(uint32_t numTiles    = fgNumTiles,
     64               uint32_t rowPerTile  = fgRowPerTile,
     65               uint64_t maxUsableMem= fgMaxUsableMem) : ofits(),
     66                                                        fMemPool(0, maxUsableMem),
     67                                                        fWriteToDiskQueue(bind(&zofits::WriteBufferToDisk, this, placeholders::_1), false)
    6868        {
    6969            InitMemberVariables(numTiles, rowPerTile, maxUsableMem);
     
    7676        /// @param maxUsableMem how many bytes of memory can be used by the compression buffers
    7777        zofits(const char* fname,
    78                uint32_t numTiles=1000,
    79                uint32_t rowPerTile=100,
    80                uint64_t maxUsableMem=0) : ofits(fname),
    81                                           fMemPool(0, maxUsableMem),
    82                                           fWriteToDiskQueue(bind(&zofits::WriteBufferToDisk, this, placeholders::_1), false)
     78               uint32_t numTiles    = fgNumTiles,
     79               uint32_t rowPerTile  = fgRowPerTile,
     80               uint64_t maxUsableMem= fgMaxUsableMem) : ofits(fname),
     81                                                        fMemPool(0, maxUsableMem),
     82                                                        fWriteToDiskQueue(bind(&zofits::WriteBufferToDisk, this, placeholders::_1), false)
    8383        {
    8484            InitMemberVariables(numTiles, rowPerTile, maxUsableMem);
     
    578578
    579579        /// static setter for the default number of threads to use. -1 means all available physical cores
    580         static void SetDefaultNumThreads(int32_t num) { fgNumQueues = num;}
    581         static int32_t GetDefaultNumThreads() { return fgNumQueues;}
     580        static void SetDefaultNumThreads   (int32_t num)   { fgNumQueues = num;}
     581        static void SetDefaultNumTiles     (uint32_t num)  { fgNumTiles = num;}
     582        static void SetDefaultNumRowPerTile(uint32_t num)  { fgRowPerTile = num;}
     583        static void SetDefaultMaxUsableMem (uint64_t size) { fgMaxUsableMem = size;}
     584
     585        static int32_t GetDefaultNumThreads()     { return fgNumQueues;}
     586        static uint32_t GetDefaultNumTiles()      { return fgNumTiles;}
     587        static uint32_t GetDefaultNumRowPerTile() { return fgRowPerTile;}
     588        static uint64_t GetDefaulMaxUsableMem()   { return fgMaxUsableMem;}
    582589
    583590        /// Get and set the actual number of threads for this object
     
    984991
    985992        //thread related stuff
    986         MemoryManager  fMemPool;               ///< Actual memory manager, providing memory for the compression buffers
    987         static int32_t fgNumQueues;           ///<  Default number of threads to be used by the objects
    988         int32_t        fNumQueues;           ///<   Current number of threads that will be used by this object
    989         uint64_t       fMaxUsableMem;       ///<    Maximum number of bytes that can be allocated by the memory manager
    990         int32_t        fLatestWrittenTile; ///<     Index of the last tile written to disk (for correct ordering while using several threads)
     993        MemoryManager   fMemPool;                  ///< Actual memory manager, providing memory for the compression buffers
     994        static int32_t  fgNumQueues;              ///<  Default number of threads to be used by the objects
     995        static uint32_t fgNumTiles;              ///< Default number of reserved tiles
     996        static uint32_t fgRowPerTile;           ///< Default number of rows per tile
     997        static uint64_t fgMaxUsableMem;        ///< Default usable memory PER OBJECT
     998        int32_t         fNumQueues;           ///<   Current number of threads that will be used by this object
     999        uint64_t        fMaxUsableMem;       ///<    Maximum number of bytes that can be allocated by the memory manager
     1000        int32_t         fLatestWrittenTile; ///<     Index of the last tile written to disk (for correct ordering while using several threads)
    9911001
    9921002        vector<Queue<CompressionTarget>>          fCompressionQueues;  ///< Processing queues (=threads)
     
    10021012
    10031013        typedef vector<CatalogEntry> CatalogRow;
    1004         typedef vector<CatalogRow>   CatalogType;
    1005         CatalogType fCatalog;              ///< Catalog for this file
    1006         uint32_t    fNumTiles;            ///<  Number of pre-reserved tiles
    1007         uint32_t    fNumRowsPerTile;     ///<   Number of rows per tile
    1008         off_t       fCatalogOffset;     ///<    Offset of the catalog from the beginning of the file
    1009         uint32_t    fCatalogExtraRows; ///<     Number of extra rows written on top of the initial capacity of the file
     1014        typedef vector<CatalogRow>     CatalogType;
     1015        CatalogType fCatalog;               ///< Catalog for this file
     1016//        uint32_t    fCatalogSize;          ///<  Actual catalog size (.size() is slow on large lists)
     1017        uint32_t    fNumTiles;            ///<   Number of pre-reserved tiles
     1018        uint32_t    fNumRowsPerTile;     ///<    Number of rows per tile
     1019        off_t       fCatalogOffset;     ///<     Offset of the catalog from the beginning of the file
     1020        uint32_t    fCatalogExtraRows; ///<      Number of extra rows written on top of the initial capacity of the file
    10101021
    10111022        // checksum related stuff
     
    10361047};
    10371048
    1038 int32_t zofits::fgNumQueues = 0;
     1049int32_t  zofits::fgNumQueues = 0;
     1050uint32_t zofits::fgNumTiles = 1000;
     1051uint32_t zofits::fgRowPerTile = 100;
     1052uint64_t zofits::fgMaxUsableMem = 1073741824; // one gigabyte
    10391053
    10401054#ifndef __MARS__
Note: See TracChangeset for help on using the changeset viewer.