Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun <skaplun@tarantool.org>
To: Igor Munkin <imun@tarantool.org>,
	Sergey Ostanevich <sergos@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v3 2/2] misc: add C and Lua API for platform metrics
Date: Mon, 5 Oct 2020 09:39:33 +0300	[thread overview]
Message-ID: <20201005063933.GB32264@root> (raw)
In-Reply-To: <fceedaeff41c398536c905b160973814842f41b3.1600615976.git.skaplun@tarantool.org>

On 20.09.20, Sergey Kaplun wrote:
> This patch introduces both C and Lua API for LuaJIT platform
<snipped>
> 
This patch isn't relevant. You can see actual version here [1].

You can apply -R corresponding diff to return to this version.
==================================================================
diff --git a/src/lib_misc.c b/src/lib_misc.c
index 287b059..ef11237 100644
--- a/src/lib_misc.c
+++ b/src/lib_misc.c
@@ -42,10 +42,6 @@ LJLIB_CF(misc_getmetrics)
   setnumfield(L, m, "gc_udatanum", metrics.gc_udatanum);
   setnumfield(L, m, "gc_cdatanum", metrics.gc_cdatanum);
 
-  setnumfield(L, m, "gc_whitenum", metrics.gc_whitenum);
-  setnumfield(L, m, "gc_graynum", metrics.gc_graynum);
-  setnumfield(L, m, "gc_blacknum", metrics.gc_blacknum);
-
   setnumfield(L, m, "gc_total", metrics.gc_total);
   setnumfield(L, m, "gc_freed", metrics.gc_freed);
   setnumfield(L, m, "gc_allocated", metrics.gc_allocated);
diff --git a/src/lj_mapi.c b/src/lj_mapi.c
index a3fb645..7645a44 100644
--- a/src/lj_mapi.c
+++ b/src/lj_mapi.c
@@ -36,10 +36,6 @@ LUAMISC_API void luaM_metrics(lua_State *L, struct luam_Metrics *metrics)
   metrics->gc_cdatanum = 0;
 #endif
 
-  metrics->gc_whitenum = gc->whitenum;
-  metrics->gc_graynum = gc->graynum;
-  metrics->gc_blacknum = gc->blacknum;
-
   metrics->gc_total = gc->total;
   metrics->gc_freed = gc->freed;
   metrics->gc_allocated = gc->allocated;
diff --git a/src/lmisclib.h b/src/lmisclib.h
index e4970b5..e2d1909 100644
--- a/src/lmisclib.h
+++ b/src/lmisclib.h
@@ -27,13 +27,6 @@ struct luam_Metrics {
   /* Amount of allocated cdata objects. */
   size_t gc_cdatanum;
 
-  /* Amount of white objects. */
-  size_t gc_whitenum;
-  /* Amount of gray objects. */
-  size_t gc_graynum;
-  /* Amount of black objects. */
-  size_t gc_blacknum;
-
   /* Memory currently allocated. */
   size_t gc_total;
   /* Total amount of freed memory. */
diff --git a/test/clib-misclib-getmetrics.test.lua b/test/clib-misclib-getmetrics.test.lua
index 840840c..34adaba 100755
--- a/test/clib-misclib-getmetrics.test.lua
+++ b/test/clib-misclib-getmetrics.test.lua
@@ -14,26 +14,12 @@ local jit_opt_default_minstitch = 0
 local tap = require('tap')
 
 local test = tap.test("clib-misc-getmetrics")
-test:plan(13)
+test:plan(10)
 
 local testgetmetrics = require("testgetmetrics")
 
 test:ok(testgetmetrics.base())
 test:ok(testgetmetrics.gc_allocated_freed())
-test:ok(testgetmetrics.gc_colors_base())
-test:ok(testgetmetrics.gc_colors_strempty())
-
--- Upvalues are never gray.
-tbar_t = {}
-test:ok(testgetmetrics.gc_colors_tbar(function()
-    local tabnew = require"table.new"
-    for i =1, 100 do
-        tbar_t.x = tabnew(i,0)
-    end
-    collectgarbage("collect")
-    tbar_t = nil
-end))
-
 test:ok(testgetmetrics.gc_steps())
 
 test:ok(testgetmetrics.objcount(function()
diff --git a/test/clib-misclib-getmetrics/testgetmetrics.c b/test/clib-misclib-getmetrics/testgetmetrics.c
index 85f0505..32802d2 100644
--- a/test/clib-misclib-getmetrics/testgetmetrics.c
+++ b/test/clib-misclib-getmetrics/testgetmetrics.c
@@ -20,10 +20,6 @@ static int base(lua_State *L)
 	assert((ssize_t)metrics.gc_udatanum >= 0);
 	assert((ssize_t)metrics.gc_cdatanum >= 0);
 
-	assert((ssize_t)metrics.gc_whitenum >= 0);
-	assert((ssize_t)metrics.gc_graynum >= 0);
-	assert((ssize_t)metrics.gc_blacknum >= 0);
-
 	assert((ssize_t)metrics.gc_total >= 0);
 	assert((ssize_t)metrics.gc_freed >= 0);
 	assert((ssize_t)metrics.gc_allocated >= 0);
@@ -63,44 +59,6 @@ static int gc_allocated_freed(lua_State *L)
 	return 1;
 }
 
-static int gc_colors_base(lua_State *L)
-{
-	struct luam_Metrics metrics;
-	lua_gc(L, LUA_GCCOLLECT, 0);
-	luaM_metrics(L, &metrics);
-	/* There are no non-white objects after full gc cycle. */
-	assert(metrics.gc_blacknum == 0);
-	assert(metrics.gc_graynum == 0);
-	lua_pushboolean(L, 1);
-	return 1;
-}
-
-static int gc_colors_strempty(lua_State *L)
-{
-	/*
-	 * Empty string is specially recolored at the end
-	 * of atomic phase.
-	 */
-	lua_pushstring(L, "");
-	/* Check that none of the internal asserts will fail. */
-	for (int i = 0; i < 100; i++)
-		lua_gc(L, LUA_GCCOLLECT, 0);
-	lua_pop(L, 1);
-	lua_pushboolean(L, 1);
-	return 1;
-}
-
-static int gc_colors_tbar(lua_State *L)
-{
-	int n = lua_gettop(L);
-	if (n != 1 || !lua_isfunction(L, 1))
-		luaL_error(L, "incorrect arguments: 1 function is required");
-	/* Check that none of the internal asserts will fail. */
-	lua_call(L, 0, 0);
-	lua_pushboolean(L, 1);
-	return 1;
-}
-
 static int gc_steps(lua_State *L)
 {
 	struct luam_Metrics oldm, newm;
@@ -269,9 +227,6 @@ static int tracenum_base(lua_State *L)
 static const struct luaL_Reg testgetmetrics[] = {
 	{"base", base},
 	{"gc_allocated_freed", gc_allocated_freed},
-	{"gc_colors_base", gc_colors_base},
-	{"gc_colors_strempty", gc_colors_strempty},
-	{"gc_colors_tbar", gc_colors_tbar},
 	{"gc_steps", gc_steps},
 	{"objcount", objcount},
 	{"snap_restores", snap_restores},
diff --git a/test/lib-misc-getmetrics.test.lua b/test/lib-misc-getmetrics.test.lua
index 66423ab..2859e26 100755
--- a/test/lib-misc-getmetrics.test.lua
+++ b/test/lib-misc-getmetrics.test.lua
@@ -7,7 +7,7 @@
 local tap = require('tap')
 
 local test = tap.test("lib-misc-getmetrics")
-test:plan(13)
+test:plan(10)
 
 local jit_opt_default_hotloop = 56
 local jit_opt_default_hotexit = 10
@@ -16,7 +16,7 @@ local jit_opt_default_minstitch = 0
 
 -- Test Lua API.
 test:test("base", function(subtest)
-    subtest:plan(22)
+    subtest:plan(19)
     local metrics = misc.getmetrics()
     subtest:ok(metrics.strhash_hit >= 0)
     subtest:ok(metrics.strhash_miss >= 0)
@@ -26,10 +26,6 @@ test:test("base", function(subtest)
     subtest:ok(metrics.gc_udatanum >= 0)
     subtest:ok(metrics.gc_cdatanum >= 0)
 
-    subtest:ok(metrics.gc_whitenum >= 2)
-    subtest:ok(metrics.gc_graynum >= 0)
-    subtest:ok(metrics.gc_blacknum >= 0)
-
     subtest:ok(metrics.gc_total >= 0)
     subtest:ok(metrics.gc_freed >= 0)
     subtest:ok(metrics.gc_allocated >= 0)
@@ -47,43 +43,6 @@ test:test("base", function(subtest)
     subtest:ok(metrics.jit_trace_num >= 0)
 end)
 
-test:test("gc-colors-base", function(subtest)
-    subtest:plan(2)
-
-    -- Force up garbage collect all dead objects.
-    collectgarbage("collect")
-
-    -- There are no non-white objects after full gc cycle.
-    local metrics = misc.getmetrics()
-    subtest:is(metrics.gc_graynum, 0)
-    subtest:is(metrics.gc_blacknum, 0)
-end)
-
-test:test("gc-colors-stremty", function(subtest)
-    subtest:plan(1)
-    -- Empty string is specially recolored at the end
-    -- of atomic phase.
-    local strempty = ""
-    -- Check that none of the internal asserts will fail.
-    for i=1, 100 do
-        collectgarbage("collect")
-    end
-    subtest:ok(true, "no assertion failed")
-end)
-
--- Upvalues are never gray.
-tbar_t = {}
-test:test("gc-colors-tbar", function(subtest)
-    subtest:plan(1)
-    local tabnew = require"table.new"
-    for i =1, 100 do
-        tbar_t.x = tabnew(i,0)
-    end
-    collectgarbage("collect")
-    tbar_t = nil
-    subtest:ok(true, "no assertion failed")
-end)
-
 test:test("gc-allocated-freed", function(subtest)
     subtest:plan(1)
 
@@ -404,26 +363,26 @@ test:test("strhash", function(subtest)
 
     local new_metrics = misc.getmetrics()
     -- Do not use test:ok to avoid extra strhash hits/misses.
-    assert(new_metrics.strhash_hit - old_metrics.strhash_hit == 22)
+    assert(new_metrics.strhash_hit - old_metrics.strhash_hit == 19)
     assert(new_metrics.strhash_miss - old_metrics.strhash_miss == 0)
     old_metrics = new_metrics
 
     local str1  = "strhash".."_hit"
 
     new_metrics = misc.getmetrics()
-    assert(new_metrics.strhash_hit - old_metrics.strhash_hit == 23)
+    assert(new_metrics.strhash_hit - old_metrics.strhash_hit == 20)
     assert(new_metrics.strhash_miss - old_metrics.strhash_miss == 0)
     old_metrics = new_metrics
 
     new_metrics = misc.getmetrics()
-    assert(new_metrics.strhash_hit - old_metrics.strhash_hit == 22)
+    assert(new_metrics.strhash_hit - old_metrics.strhash_hit == 19)
     assert(new_metrics.strhash_miss - old_metrics.strhash_miss == 0)
     old_metrics = new_metrics
 
     local str2 = "new".."string"
 
     new_metrics = misc.getmetrics()
-    assert(new_metrics.strhash_hit - old_metrics.strhash_hit == 22)
+    assert(new_metrics.strhash_hit - old_metrics.strhash_hit == 19)
     assert(new_metrics.strhash_miss - old_metrics.strhash_miss == 1)
     subtest:ok(true, "no assertion failed")
 end)
==================================================================

[1]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-October/019882.html

-- 
Best regards,
Sergey Kaplun

  reply	other threads:[~2020-10-05  6:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-20 17:12 [Tarantool-patches] [PATCH v3 0/2] Implement LuaJIT " Sergey Kaplun
2020-09-20 17:12 ` [Tarantool-patches] [PATCH v3 1/2] core: introduce various " Sergey Kaplun
2020-10-05  6:36   ` Sergey Kaplun
2020-09-20 17:12 ` [Tarantool-patches] [PATCH v3 2/2] misc: add C and Lua API for " Sergey Kaplun
2020-10-05  6:39   ` Sergey Kaplun [this message]
2020-09-20 17:13 ` [Tarantool-patches] [RFC v3] rfc: luajit metrics Sergey Kaplun
2020-09-21 15:18   ` Sergey Kaplun
2020-09-21 15:15 ` Sergey Kaplun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201005063933.GB32264@root \
    --to=skaplun@tarantool.org \
    --cc=imun@tarantool.org \
    --cc=sergos@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v3 2/2] misc: add C and Lua API for platform metrics' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox