summaryrefslogtreecommitdiff
path: root/test/endless/test-profile.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2017-09-19 17:31:58 +0100
committerP. F. Chimento <philip.chimento@gmail.com>2018-01-10 10:28:35 -0800
commitd409acb19785a3d42ccea934f584ab67a052eea2 (patch)
tree372a936b54ec4674b46faf4f75160cabca2a9e0c /test/endless/test-profile.c
parent9febff20c71f7112a3652cba81d41b260c178716 (diff)
Add test for profiling API
Diffstat (limited to 'test/endless/test-profile.c')
-rw-r--r--test/endless/test-profile.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/endless/test-profile.c b/test/endless/test-profile.c
new file mode 100644
index 0000000..398858e
--- /dev/null
+++ b/test/endless/test-profile.c
@@ -0,0 +1,30 @@
+/* Copyright 2017 Endless Mobile, Inc. */
+
+#include <stdlib.h>
+#include <endless/endless.h>
+
+#include "run-tests.h"
+
+static void
+test_profile_stdout (void)
+{
+ g_autoptr(EosProfileProbe) probe = EOS_PROFILE_PROBE ("/sdk/profile/main");
+
+ for (int i = 0; i < 256000; i++)
+ {
+ g_autoptr(EosProfileProbe) inner = EOS_PROFILE_PROBE ("/sdk/profile/inner-loop");
+
+ GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
+
+ for (int j = 0; j < 1000; j++)
+ g_array_append_val (array, j);
+
+ g_array_unref (array);
+ }
+}
+
+void
+add_profile_tests (void)
+{
+ g_test_add_func ("/profile/stdout", test_profile_stdout);
+}