pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:1:
/* -*- c -*- || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: builtin.cmod,v 1.
258
2010/
05
/
28
18
:
34
:
40
mast Exp $
+
|| $Id: builtin.cmod,v 1.
259
2010/
06
/
22
09
:
24
:
35
mast Exp $
*/ #include "global.h" #include "interpret.h" #include "svalue.h" #include "pike_macros.h" #include "object.h" #include "program.h" #include "array.h" #include "pike_error.h"
pike.git/src/builtin.cmod:507:
*! *! @mapping *! @member int "enabled" *! If this is 1 then the gc is enabled as usual. If it's 0 then all *! automatically scheduled gc runs are disabled and the parameters *! below have no effect, but explicit runs through the @[gc] *! function still works as usual. If it's -1 then the gc is *! completely disabled so that even explicit @[gc] calls won't do *! anything. *! @member float "garbage_ratio_low"
-
*! As long as the gc time is less than
gc_
time_ratio, aim to run
+
*! As long as the gc time is less than time_ratio
below
, aim to run
*! the gc approximately every time the ratio between the garbage *! and the total amount of allocated things is this. *! @member float "time_ratio"
-
*! When more than this fraction of the
cpu
time is spent in the gc,
-
*!
aim
for
gc_
garbage_ratio_high instead of
gc_
garbage_ratio_low.
+
*! When more than this fraction of the time is spent in the gc,
aim
+
*! for garbage_ratio_high instead of garbage_ratio_low.
*! @member float "garbage_ratio_high" *! Upper limit for the garbage ratio - run the gc as often as it *! takes to keep it below this.
-
+
*! @member float "min_gc_time_ratio"
+
*! This puts an upper limit on the gc interval, in addition to the
+
*! factors above. It is specified as the minimum amount of time
+
*! spent doing gc, as a factor of the total time. The reason for
+
*! this limit is that the current amount of garbage can only be
+
*! measured in a gc run, and if the gc starts to run very seldom
+
*! due to very little garbage, it might get too slow to react to an
+
*! increase in garbage generation. Set to 0.0 to turn this limit
+
*! off.
*! @member float "average_slowness" *! When predicting the next gc interval, use a decaying average *! with this slowness factor. It should be a value between 0.0 and *! 1.0 that specifies the weight to give to the old average value. *! The remaining weight up to 1.0 is given to the last reading. *! @endmapping *! *! @seealso *! @[gc], @[Debug.gc_status] */ PMOD_EXPORT PIKEFUN mapping(string:mixed) gc_parameters (void|mapping(string:mixed) params) errname Pike.gc_parameters; optflags OPT_SIDE_EFFECT; { struct pike_string *str; struct svalue *set; struct svalue get; if (!params) {
-
push_mapping (allocate_mapping (
5
));
+
push_mapping (allocate_mapping (
6
));
params = Pike_sp[-1].u.mapping; } #define HANDLE_PARAM(NAME, CHECK_AND_SET, GET) do { \ MAKE_CONST_STRING (str, NAME); \ if ((set = low_mapping_string_lookup (params, str))) { \ CHECK_AND_SET; \ } \ else { \ GET; \
pike.git/src/builtin.cmod:584:
} } }, { get.type = T_INT; get.subtype = NUMBER_NUMBER; get.u.integer = gc_enabled; }); HANDLE_FLOAT_FACTOR ("garbage_ratio_low", gc_garbage_ratio_low); HANDLE_FLOAT_FACTOR ("time_ratio", gc_time_ratio); HANDLE_FLOAT_FACTOR ("garbage_ratio_high", gc_garbage_ratio_high);
+
HANDLE_FLOAT_FACTOR ("min_gc_time_ratio", gc_min_time_ratio);
HANDLE_FLOAT_FACTOR ("average_slowness", gc_average_slowness); #undef HANDLE_PARAM #undef HANDLE_FLOAT_FACTOR REF_RETURN params; } /*! @decl string ctime(int timestamp) *!