summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/passes/Metrics.cpp4
-rw-r--r--test/passes/O3_low-memory-unused_metrics.txt1
-rw-r--r--test/passes/converge_O3_metrics.bin.txt3
-rw-r--r--test/passes/func-metrics.txt6
-rw-r--r--test/passes/metrics.txt2
-rw-r--r--test/passes/metrics_strip-debug_metrics.bin.txt2
-rw-r--r--test/passes/metrics_strip-producers_metrics.bin.txt2
7 files changed, 18 insertions, 2 deletions
diff --git a/src/passes/Metrics.cpp b/src/passes/Metrics.cpp
index ca558cd4f..af5a62697 100644
--- a/src/passes/Metrics.cpp
+++ b/src/passes/Metrics.cpp
@@ -62,10 +62,10 @@ struct Metrics
walkTable(&module->table);
walkMemory(&module->memory);
- // add imports
+ // add imports / funcs / globals/ exports
counts["[imports]"] = imports.getNumImports();
- // add functions
counts["[funcs]"] = imports.getNumDefinedFunctions();
+ counts["[globals]"] = imports.getNumDefinedGlobals();
counts["[exports]"] = module->exports.size();
// add memory and table
if (module->memory.exists) {
diff --git a/test/passes/O3_low-memory-unused_metrics.txt b/test/passes/O3_low-memory-unused_metrics.txt
index 756d8cc61..f4b009765 100644
--- a/test/passes/O3_low-memory-unused_metrics.txt
+++ b/test/passes/O3_low-memory-unused_metrics.txt
@@ -1,6 +1,7 @@
total
[exports] : 1
[funcs] : 1
+ [globals] : 0
[imports] : 10
[memory-data] : 0
[table-data] : 0
diff --git a/test/passes/converge_O3_metrics.bin.txt b/test/passes/converge_O3_metrics.bin.txt
index 00835cc1e..dd8470d0d 100644
--- a/test/passes/converge_O3_metrics.bin.txt
+++ b/test/passes/converge_O3_metrics.bin.txt
@@ -1,6 +1,7 @@
total
[exports] : 2
[funcs] : 8
+ [globals] : 1
[imports] : 3
[memory-data] : 28
[table-data] : 429
@@ -243,6 +244,7 @@ total
total
[exports] : 2
[funcs] : 8
+ [globals] : 1
[imports] : 3
[memory-data] : 28
[table-data] : 429
@@ -486,6 +488,7 @@ total
total
[exports] : 2
[funcs] : 8
+ [globals] : 1
[imports] : 3
[memory-data] : 28
[table-data] : 429
diff --git a/test/passes/func-metrics.txt b/test/passes/func-metrics.txt
index fa4857b56..1ca1c66f5 100644
--- a/test/passes/func-metrics.txt
+++ b/test/passes/func-metrics.txt
@@ -1,6 +1,7 @@
global
[exports] : 0
[funcs] : 3
+ [globals] : 1
[imports] : 0
[memory-data] : 9
[table-data] : 3
@@ -90,6 +91,7 @@ func: ifs
global
[exports] : 0
[funcs] : 0
+ [globals] : 0
[imports] : 0
[total] : 0
(module
@@ -97,6 +99,7 @@ global
global
[exports] : 2
[funcs] : 3
+ [globals] : 0
[imports] : 1
[total] : 0
func: func_a
@@ -170,6 +173,7 @@ export: b (func_b)
global
[exports] : 1
[funcs] : 1
+ [globals] : 0
[imports] : 1
[total] : 0
func: func_a
@@ -200,6 +204,7 @@ start: func_a
global
[exports] : 0
[funcs] : 1
+ [globals] : 0
[imports] : 1
[total] : 0
func: func_a
@@ -226,6 +231,7 @@ start: func_a
global
[exports] : 1
[funcs] : 1
+ [globals] : 1
[imports] : 1
[total] : 1
global.get : 1
diff --git a/test/passes/metrics.txt b/test/passes/metrics.txt
index 096194e84..95ca2c601 100644
--- a/test/passes/metrics.txt
+++ b/test/passes/metrics.txt
@@ -1,6 +1,7 @@
total
[exports] : 0
[funcs] : 1
+ [globals] : 1
[imports] : 0
[memory-data] : 9
[table-data] : 3
@@ -61,6 +62,7 @@ total
total
[exports] : 0
[funcs] : 0
+ [globals] : 0
[imports] : 0
[total] : 0
[vars] : 0
diff --git a/test/passes/metrics_strip-debug_metrics.bin.txt b/test/passes/metrics_strip-debug_metrics.bin.txt
index 0efad35f5..3e7294453 100644
--- a/test/passes/metrics_strip-debug_metrics.bin.txt
+++ b/test/passes/metrics_strip-debug_metrics.bin.txt
@@ -1,6 +1,7 @@
total
[exports] : 1
[funcs] : 1
+ [globals] : 0
[imports] : 0
[total] : 1
[vars] : 0
@@ -8,6 +9,7 @@ total
total
[exports] : 1
[funcs] : 1
+ [globals] : 0
[imports] : 0
[total] : 1
[vars] : 0
diff --git a/test/passes/metrics_strip-producers_metrics.bin.txt b/test/passes/metrics_strip-producers_metrics.bin.txt
index e630c14b7..e977d4ed5 100644
--- a/test/passes/metrics_strip-producers_metrics.bin.txt
+++ b/test/passes/metrics_strip-producers_metrics.bin.txt
@@ -1,6 +1,7 @@
total
[exports] : 1
[funcs] : 1
+ [globals] : 0
[imports] : 0
[total] : 1
[vars] : 0
@@ -8,6 +9,7 @@ total
total
[exports] : 1
[funcs] : 1
+ [globals] : 0
[imports] : 0
[total] : 1
[vars] : 0