summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-05-08 04:39:25 -0600
committerSimon Glass <sjg@chromium.org>2022-06-28 03:09:52 +0100
commit0dfda34ca594c701955cfcb71711a7599f97bae3 (patch)
treebc1741d705ae3a62c98477e510535d3193c97802 /test
parent930a3ddadebf3660cc3163081671de189300afdd (diff)
downloadu-boot-0dfda34ca594c701955cfcb71711a7599f97bae3.tar.gz
u-boot-0dfda34ca594c701955cfcb71711a7599f97bae3.tar.bz2
u-boot-0dfda34ca594c701955cfcb71711a7599f97bae3.zip
dm: core: Add a way to collect memory usage
Add a function for collecting the amount of memory used by driver model, including devices, uclasses and attached data and tags. This information can provide insights into how to reduce the memory required by driver model. Future work may look at execution speed also. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/dm/core.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/dm/core.c b/test/dm/core.c
index 26e2fd5661..fd4d756972 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -1355,3 +1355,14 @@ static int dm_test_dev_get_attach_bus(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_dev_get_attach_bus, UT_TESTF_SCAN_FDT);
+
+/* Test getting information about tags attached to bus devices */
+static int dm_test_dev_get_mem(struct unit_test_state *uts)
+{
+ struct dm_stats stats;
+
+ dm_get_mem(&stats);
+
+ return 0;
+}
+DM_TEST(dm_test_dev_get_mem, UT_TESTF_SCAN_FDT);