Changeset: 12b2d710db0b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/12b2d710db0b
Modified Files:
gdk/gdk_system.c
Branch: Dec2025
Log Message:
Attempt to figure out number of configured CPUs inside docker container.
diffs (25 lines):
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -1249,6 +1249,21 @@ MT_check_nr_cores(void)
if (ncpu < ncpus)
return ncpu;
}
+ } else {
+ f = fopen("/sys/fs/cgroup/cpu.max", "r");
+ if (f != NULL) {
+ int32_t quota, period;
+ /* there should either be two numbers, or the
+ * word "max" followed by a number; the latter
+ * case is ignored by the fscanf not returning
+ * 2 */
+ if (fscanf(f, SCNi32 " " SCNi32, "a, &period) == 2
&& period > 0) {
+ int ncpu = quota / period;
+ if (ncpu < ncpus)
+ ncpus = ncpu;
+ }
+ fclose(f);
+ }
}
#endif
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]