diff --git a/src/Filter.hpp b/src/Filter.hpp index 1c1d9daacf2c36d6598a0cf2ccc9c632ee187ebe..5da669ca5326f43737aac273e164eaca8cb4b842 100644 --- a/src/Filter.hpp +++ b/src/Filter.hpp @@ -31,9 +31,10 @@ class Filter { ShortCountMinSketch * pShortCMS; FasqQualThreshold qual_thres; - long nb_bytes_before_fill_CMS,nb_bytes_after_fill_CMS; + // long nb_bytes_before_fill_CMS,nb_bytes_after_fill_CMS; + long nb_bytes_CMS; //! Number of bytes taken by the underlying CMS. - void getRSS(int before_fill=0); + void getRSS(); template <typename T> void underlyingfillCMS(FqBaseBackend* map_id_backend[],int nb_be, int k, srp* io_sr, CountMinSketch<T>* cms); @@ -44,12 +45,12 @@ public: Filter(const CMSparams& parms,const FasqQualThreshold& the_qual_thres) { pByteCMS=NULL; pShortCMS=NULL; - getRSS(); if (parms.kappa<ubytemask) pByteCMS=new ByteCountMinSketch(parms); else pShortCMS=new ShortCountMinSketch(parms); qual_thres=the_qual_thres; - - nb_bytes_after_fill_CMS=0; + getRSS(); + //nb_bytes_CMS=0; + //nb_bytes_after_fill_CMS=0; } void fillCMS(FqBaseBackend* map_id_backend[],int nb_be,int k,srp* io_sr); @@ -142,7 +143,7 @@ template <typename T> void Filter::underlyinglowFilterCMS(FqBaseBackend* map_id_ void Filter::fillCMS(FqBaseBackend* map_id_backend[],int nb_be,int k,srp* io_sr) { if (pByteCMS!=NULL) underlyingfillCMS<unsigned char>(map_id_backend,nb_be, k, io_sr,pByteCMS); else underlyingfillCMS<unsigned short>(map_id_backend,nb_be, k, io_sr,pShortCMS); - getRSS(1); + getRSS(); } void Filter::lowFilterCMS(FqBaseBackend* map_id_backend[],int nb_be,int k, srp* io_sr) { @@ -160,16 +161,15 @@ std::vector<unsigned long> Filter::getUnsetBuckets() const { else return pShortCMS->getUnsetBuckets(); } -void Filter::getRSS(int before_fill) { +void Filter::getRSS() { struct rusage usage; int res2=getrusage(RUSAGE_SELF,&usage); if (res2==-1) err(errno,"cannot get resource usage."); - if (before_fill==0) nb_bytes_before_fill_CMS=usage.ru_maxrss; - else nb_bytes_after_fill_CMS=usage.ru_maxrss; + nb_bytes_CMS=usage.ru_maxrss; } unsigned long Filter::getSize() { - unsigned long cms_size=nb_bytes_after_fill_CMS-nb_bytes_before_fill_CMS; + unsigned long cms_size=nb_bytes_CMS; // cms_size/=8; ru_maxrss seems to be already in Bytes. return cms_size; }