Esempio n. 1
0
static int luv_resident_set_memory(lua_State* L) {
  size_t rss;
  int ret = uv_resident_set_memory(&rss);
  if (ret < 0) return luv_error(L, ret);
  lua_pushinteger(L, rss);
  return 1;
}
Esempio n. 2
0
/*
 * Class:     com_iwebpp_libuvpp_LibUV
 * Method:    _rss
 * Signature: ()I
 */
extern "C" JNIEXPORT  jint JNICALL Java_com_iwebpp_libuvpp_LibUV__1rss
(JNIEnv *env, jclass cls) {

    size_t rss;
    uv_err_t err = uv_resident_set_memory(&rss);
    if (err.code != UV_OK) {
        ThrowException(env, err.code, "uv_resident_set_memory", NULL, NULL);
    }
    return static_cast<jint>(rss);
}
Esempio n. 3
0
static int process_memory_usage(lua_State *L) {
  lua_newtable(L);

  size_t rss;
  uv_err_t err = uv_resident_set_memory(&rss);
  if (err.code != UV_OK) {
    uv_err_t err = uv_last_error(lev_get_loop(L));
    return luaL_error(L, uv_strerror(err));
  }
  lua_pushnumber(L, rss);
  lua_setfield(L, -2, "rss");

  return 1;
}
Esempio n. 4
0
File: util.c Progetto: Sevenops/pyuv
static PyObject *
Util_func_resident_set_memory(PyObject *obj)
{
    size_t rss;
    int err;
    PyObject *exc_data;

    UNUSED_ARG(obj);

    err = uv_resident_set_memory(&rss);
    if (err == 0) {
        return PyInt_FromSsize_t(rss);
    } else {
        exc_data = Py_BuildValue("(is)", err, uv_strerror(err));
        if (exc_data != NULL) {
            PyErr_SetObject(PyExc_UVError, exc_data);
            Py_DECREF(exc_data);
        }
        return NULL;
    }
}
Esempio n. 5
0
static MVMint32 is_full_collection(MVMThreadContext *tc) {
    MVMuint64 percent_growth, promoted;
    size_t rss;

    /* If it's below the absolute minimum, quickly return. */
    promoted = (MVMuint64)MVM_load(&tc->instance->gc_promoted_bytes_since_last_full);
    if (promoted < MVM_GC_GEN2_THRESHOLD_MINIMUM)
        return 0;

    /* If we're heap profiling then don't consider the resident set size, as
     * it will be hugely distorted by the profile data we record. */
    if (MVM_profile_heap_profiling(tc))
        return 1;

    /* Otherwise, consider percentage of resident set size. */
    if (uv_resident_set_memory(&rss) < 0 || rss == 0)
        rss = 50 * 1024 * 1024;
    percent_growth = (100 * promoted) / (MVMuint64)rss;

    return percent_growth >= MVM_GC_GEN2_THRESHOLD_PERCENT;
}
Esempio n. 6
0
File: util.c Progetto: lparam/xTun
void
print_rss() {
    size_t rss;
    uv_resident_set_memory(&rss);
    logger_log(LOG_DEBUG, "resident set memory: %llu", (unsigned long long) rss);
}