@@ -600,6 +600,28 @@ static PyObject *py_zstd_threads_count(PyObject* self, PyObject *args)
600600 return Py_BuildValue ("i" , threads );
601601}
602602
603+ /**
604+ * Returns ZSTD determined cpu count, int
605+ */
606+ static PyObject * py_zstd_cpu_count_sysconf (PyObject * self , PyObject * args )
607+ {
608+ UNUSED (self );
609+ UNUSED (args );
610+ int32_t threads = UTIL_countAvailableCores_posix_sysconf ();
611+ return Py_BuildValue ("i" , threads );
612+ }
613+
614+ /**
615+ * Returns ZSTD determined cpu count, int
616+ */
617+ static PyObject * py_zstd_cpu_count_cpuinfo (PyObject * self , PyObject * args )
618+ {
619+ UNUSED (self );
620+ UNUSED (args );
621+ int32_t threads = UTIL_countAvailableCores_parse_cpuinfo ();
622+ return Py_BuildValue ("i" , threads );
623+ }
624+
603625static PyObject * py_zstd_set_cpu_cores_cache_ttl (PyObject * self , PyObject * args )
604626{
605627 UNUSED (self );
@@ -697,6 +719,8 @@ static PyMethodDef ZstdMethods[] = {
697719 {"ZSTD_version_loaded" , py_zstd_library_version_loaded , METH_NOARGS , NULL },
698720 {"ZSTD_version_number" , py_zstd_library_version_int , METH_NOARGS , ZSTD_INT_VERSION_DOCSTRING },
699721 {"ZSTD_threads_count" , py_zstd_threads_count , METH_NOARGS , ZSTD_THREADS_COUNT_DOCSTRING },
722+ {"ZSTD_cpu_count_sysconf" , py_zstd_cpu_count_sysconf , METH_NOARGS , ZSTD_THREADS_COUNT_DOCSTRING },
723+ {"ZSTD_cpu_count_cpuinfo" , py_zstd_cpu_count_cpuinfo , METH_NOARGS , ZSTD_THREADS_COUNT_DOCSTRING },
700724 {"ZSTD_max_threads_count" , py_zstd_max_threads_count , METH_NOARGS , ZSTD_MAX_THREADS_COUNT_DOCSTRING },
701725 {"ZSTD_min_compression_level" , py_zstd_min_compression_level , METH_NOARGS , ZSTD_MIN_COMPRESSION_LEVEL_DOCSTRING },
702726 {"ZSTD_max_compression_level" , py_zstd_max_compression_level , METH_NOARGS , ZSTD_MAX_COMPRESSION_LEVEL_DOCSTRING },
0 commit comments