[asterisk-commits] eliel: branch group/data_api_gsoc2009 r204409 - /team/group/data_api_gsoc2009...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 30 11:21:21 CDT 2009
Author: eliel
Date: Tue Jun 30 11:21:18 2009
New Revision: 204409
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=204409
Log:
The benchmark is based on a null provider (a provider without content),
and a full provider (that generated nodes inside it).
Modified:
team/group/data_api_gsoc2009/tests/test_data.c
Modified: team/group/data_api_gsoc2009/tests/test_data.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/tests/test_data.c?view=diff&rev=204409&r1=204408&r2=204409
==============================================================================
--- team/group/data_api_gsoc2009/tests/test_data.c (original)
+++ team/group/data_api_gsoc2009/tests/test_data.c Tue Jun 30 11:21:18 2009
@@ -39,7 +39,7 @@
#include "asterisk/cli.h"
#include "asterisk/data.h"
-static struct ast_data *test_data_provider(void)
+static struct ast_data *test_data_full_provider(void)
{
struct ast_data *res, *internal;
@@ -62,23 +62,36 @@
return res;
}
-static const struct ast_data_handler test_provider = {
- .get = test_data_provider
+static struct ast_data *test_data_null_provider(void)
+{
+ return NULL;
+}
+
+static const struct ast_data_handler full_provider = {
+ .get = test_data_full_provider
+};
+
+static const struct ast_data_handler null_provider = {
+ .get = test_data_null_provider
};
static const struct ast_data_entry test_providers[] = {
- AST_DATA_ENTRY("test/node1/node11/node111", &test_provider),
- AST_DATA_ENTRY("test/node1/node12/node121", &test_provider),
- AST_DATA_ENTRY("test/node1/node13/node131", &test_provider),
- AST_DATA_ENTRY("test/node2/node14/node141", &test_provider),
- AST_DATA_ENTRY("test/node2/node14/node142", &test_provider),
- AST_DATA_ENTRY("test/node2/node15/node151", &test_provider),
- AST_DATA_ENTRY("test/node2/node15/node152", &test_provider),
+ AST_DATA_ENTRY("test/node1/node11/node111", &full_provider),
+ AST_DATA_ENTRY("test/node1/node12/node121", &full_provider),
+ AST_DATA_ENTRY("test/node1/node13/node131", &full_provider),
+ AST_DATA_ENTRY("test/node2/node14/node141", &full_provider),
+ AST_DATA_ENTRY("test/node2/node14/node142", &full_provider),
+ AST_DATA_ENTRY("test/node2/node15/node151", &full_provider),
+ AST_DATA_ENTRY("test/node2/node15/node152", &full_provider),
+ AST_DATA_ENTRY("test/null/node1/node2/node3/node4/node5/node6", &null_provider),
};
static char *handle_cli_data_get_bench(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- struct ast_data_query query = {
+ struct ast_data_query query_null = {
+ .path = "test/null",
+ };
+ struct ast_data_query query_full = {
.path = "test",
};
struct ast_data *res;
@@ -95,13 +108,21 @@
return NULL;
}
+ /* null provider. */
+ ast_cli(a->fd, "Null provider\n");
start = ast_tvnow();
-
- res = ast_data_get(&query);
-
+ res = ast_data_get(&query_null);
ast_cli(a->fd, "Test complete - %" PRIi64 " us\n", ast_tvdiff_us(ast_tvnow(), start));
-
ast_data_free(res);
+ /* TODO: Show tree deph and number of nodes. */
+
+ /* null provider. */
+ ast_cli(a->fd, "Full test tree\n");
+ start = ast_tvnow();
+ res = ast_data_get(&query_full);
+ ast_cli(a->fd, "Test complete - %" PRIi64 " us\n", ast_tvdiff_us(ast_tvnow(), start));
+ ast_data_free(res);
+ /* TODO: Show tree deph and number of nodes. */
return CLI_SUCCESS;
}
More information about the asterisk-commits
mailing list