File 2372-Add-benchmark.patch of Package erlang

From 7e4c18d1a750f53e16e4b06707722164411bf462 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Thu, 11 Apr 2019 12:55:35 +0200
Subject: [PATCH 2/2] Add benchmark

---
 erts/emulator/test/emulator_bench.spec  |  1 +
 erts/emulator/test/erts_debug_SUITE.erl | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/erts/emulator/test/emulator_bench.spec b/erts/emulator/test/emulator_bench.spec
index 2a180b440c..03638bfa23 100644
--- a/erts/emulator/test/emulator_bench.spec
+++ b/erts/emulator/test/emulator_bench.spec
@@ -1,2 +1,3 @@
 {groups,"../emulator_test",estone_SUITE,[estone_bench]}.
 {groups,"../emulator_test",binary_SUITE,[iolist_size_benchmarks]}.
+{groups,"../emulator_test",erts_debug_SUITE,[interpreter_size_bench]}.
diff --git a/erts/emulator/test/erts_debug_SUITE.erl b/erts/emulator/test/erts_debug_SUITE.erl
index f39dbedd8f..6798e3bf25 100644
--- a/erts/emulator/test/erts_debug_SUITE.erl
+++ b/erts/emulator/test/erts_debug_SUITE.erl
@@ -20,10 +20,12 @@
 
 -module(erts_debug_SUITE).
 -include_lib("common_test/include/ct.hrl").
+-include_lib("common_test/include/ct_event.hrl").
 
--export([all/0, suite/0,
+-export([all/0, suite/0, groups/0,
 	 test_size/1,flat_size_big/1,df/1,term_type/1,
-	 instructions/1, stack_check/1]).
+	 instructions/1, stack_check/1,
+         interpreter_size_bench/1]).
 
 suite() ->
     [{ct_hooks,[ts_install_cth]},
@@ -33,6 +35,15 @@ all() ->
     [test_size, flat_size_big, df, instructions, term_type,
      stack_check].
 
+groups() -> 
+    [{interpreter_size_bench, [], [interpreter_size_bench]}].
+
+interpreter_size_bench(_Config) ->
+    Size = erts_debug:interpreter_size(),
+    ct_event:notify(#event{name=benchmark_data,
+                           data=[{value,Size}]}),
+    {comment,integer_to_list(Size)++" bytes"}.
+
 test_size(Config) when is_list(Config) ->
     ConsCell1 = id([a|b]),
     ConsCell2 = id(ConsCell1),
-- 
2.16.4

openSUSE Build Service is sponsored by