diff --git a/README.md b/README.md index c1d9c38e5416221d7ecccf76542cf1cebdce1880..9a15da95faea37ac2efa4e8994c0654105f82a9f 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Then copy your resulting wheel and install it via pip on the target system. ## v0.5.3 -* added `disable_mmap` and `enable_mmap` into `VarlenSeries` +* added `disable_mmap`, `enable_mmap` and `open_chunks_mmap_size` into `VarlenSeries` ## v0.5.2 diff --git a/setup.py b/setup.py index 6382a8a8863613c4c8c357b68068eacf3b4e6972..1ed60fa7247870da07fbf1427cc64506f297b7b7 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ ext_modules = build([Multibuild('tempsdb', find_pyx('tempsdb'), **ext_kwargs), ] **cythonize_kwargs) setup(name='tempsdb', - version='0.5.3a1', + version='0.5.3', packages=find_packages(include=['tempsdb', 'tempsdb.*']), install_requires=['satella>=2.14.24', 'ujson'], ext_modules=ext_modules, diff --git a/tempsdb/database.pyx b/tempsdb/database.pyx index 62c340c8fe8de673bf9e4f0fb7c963b2ae1d6ad3..c74171da66f25da501d5707e95a3179620e4c47d 100644 --- a/tempsdb/database.pyx +++ b/tempsdb/database.pyx @@ -230,6 +230,8 @@ cdef class Database: :return: new variable length series :raises AlreadyExists: series with given name already exists """ + from .varlen import create_varlen_series + cdef: VarlenSeries series str path = os.path.join(self.path, 'varlen', name) diff --git a/tempsdb/varlen.pxd b/tempsdb/varlen.pxd index ac2feb9d2ceebb0ee837dd92b9bd0f59ec7fc698..1b125279e8cebb0849c1506fc6bed0d00c5d96a7 100644 --- a/tempsdb/varlen.pxd +++ b/tempsdb/varlen.pxd @@ -20,6 +20,7 @@ cdef class VarlenSeries: cpdef int enable_mmap(self) except -1 cpdef int disable_mmap(self) except -1 + cpdef unsigned long open_chunks_mmap_size(self) cpdef int mark_synced_up_to(self, unsigned long long timestamp) except -1 cpdef int close(self, bint force=*) except -1 cpdef int delete(self) except -1 diff --git a/tempsdb/varlen.pyx b/tempsdb/varlen.pyx index f381b956e4165dea5f4af7b52bb72207c19e4b27..046fccce5cb8fd677785f659e26766fc585f5c81 100644 --- a/tempsdb/varlen.pyx +++ b/tempsdb/varlen.pyx @@ -651,6 +651,17 @@ cdef class VarlenSeries: """ return self.length_profile[-1 if index >= len(self.length_profile) else index] + cpdef unsigned long open_chunks_mmap_size(self): + """ + :return: total area of memory taken by mmaps, in bytes + """ + cdef: + unsigned long long total = 0 + TimeSeries series + for series in self.series: + total += series.open_chunks_mmap_size() + return total + cpdef int close(self, bint force=False) except -1: """ Close this series.