annotate tests/testmesg_stress.c @ 1327:82b386714795

Set callback data also when only setting expire callback (and not answer callback as well). It is used when calling the expire callback, so not setting it makes no sense.
author Thomas Klausner <tk@giga.or.at>
date Mon, 27 Nov 2017 15:21:20 +0100
parents ccbd1426e04a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
1 /*********************************************************************************************************
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
2 * Software License Agreement (BSD License) *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
4 * *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
5 * Copyright (c) 2013, WIDE Project and NICT *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
6 * All rights reserved. *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
7 * *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
8 * Redistribution and use of this software in source and binary forms, with or without modification, are *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
9 * permitted provided that the following conditions are met: *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
10 * *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
11 * * Redistributions of source code must retain the above *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
12 * copyright notice, this list of conditions and the *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
13 * following disclaimer. *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
14 * *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
15 * * Redistributions in binary form must reproduce the above *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
16 * copyright notice, this list of conditions and the *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
17 * following disclaimer in the documentation and/or other *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
18 * materials provided with the distribution. *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
19 * *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
20 * * Neither the name of the WIDE Project or NICT nor the *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
21 * names of its contributors may be used to endorse or *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
22 * promote products derived from this software without *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
23 * specific prior written permission of WIDE Project and *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
24 * NICT. *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
25 * *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
34 *********************************************************************************************************/
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
35
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
36 #include "tests.h"
1121
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
37 #include <dirent.h>
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
38 #include <libgen.h>
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
39 #include <dlfcn.h>
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
40
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
41 #ifndef BUILD_DIR
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
42 #error "Missing BUILD_DIR information"
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
43 #endif /* BUILD_DIR */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
44
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
45
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
46 /* The number of times each operation is repeated to measure the average operation time */
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
47 #define DEFAULT_NUMBER_OF_SAMPLES 100000
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
48
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
49 static void display_result(int nr, struct timespec * start, struct timespec * end, char * fct, char * type, char *op)
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
50 {
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
51 long double dur = (long double)end->tv_sec + (long double)end->tv_nsec/1000000000;
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
52 dur -= (long double)start->tv_sec + (long double)start->tv_nsec/1000000000;
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
53 long double thrp = (long double)nr / dur;
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
54 printf("%-19s: %d %-8s %-7s in %.6LFs (%.1LFmsg/s)\n", fct, nr, type, op, dur, thrp);
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
55 }
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
56
1121
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
57 struct ext_info {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
58 struct fd_list chain; /* link in the list */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
59 void *handler; /* object returned by dlopen() */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
60 int (*init_cb)(int, int, char *);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
61 char *ext_name; /* points to the extension name, either inside depends, or basename(filename) */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
62 int free_ext_name; /* must be freed if it was malloc'd */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
63 const char **depends; /* names of the other extensions this one depends on (if provided) */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
64 };
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
65
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
66 static void load_all_extensions(char * prefix)
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
67 {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
68 DIR *dir;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
69 struct dirent *dp;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
70 char fullname[512];
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
71 int pathlen;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
72 struct fd_list all_extensions = FD_LIST_INITIALIZER(all_extensions);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
73 struct fd_list ext_with_depends = FD_LIST_INITIALIZER(ext_with_depends);
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
74
1121
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
75 /* Find all extensions which have been compiled along the test */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
76 LOG_D("Loading %s*.fdx from: '%s'", BUILD_DIR "/extensions", prefix ?: "");
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
77 CHECK( 0, (dir = opendir (BUILD_DIR "/extensions")) == NULL ? 1 : 0 );
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
78 pathlen = snprintf(fullname, sizeof(fullname), BUILD_DIR "/extensions/");
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
79
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
80 while ((dp = readdir (dir)) != NULL) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
81 char * dot = strrchr(dp->d_name, '.');
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
82 if (dot && ((!prefix) || !(strncmp(dp->d_name, prefix, strlen(prefix)))) && (!(strcmp(dot, ".fdx")))) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
83 /* We found a file with name dict_*.fdx, attempt to load it */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
84 struct ext_info * new = malloc(sizeof(struct ext_info));
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
85 CHECK( 1, new ? 1:0);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
86 fd_list_init(&new->chain, new);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
87
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
88 snprintf(fullname + pathlen, sizeof(fullname) - pathlen, "%s", dp->d_name);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
89
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
90 LOG_D("Extension: '%s'", dp->d_name);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
91
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
92 /* load */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
93 new->handler = dlopen(fullname, RTLD_NOW | RTLD_GLOBAL);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
94 if (!new->handler) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
95 TRACE_DEBUG(INFO, "Unable to load '%s': %s.", fullname, dlerror());
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
96 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
97 CHECK( 0, new->handler == NULL ? 1 : 0 );
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
98
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
99 /* resolve entry */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
100 new->init_cb = dlsym( new->handler, "fd_ext_init" );
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
101 if (!new->init_cb) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
102 TRACE_DEBUG(INFO, "No 'fd_ext_init' entry point in '%s': %s.", fullname, dlerror());
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
103 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
104 CHECK( 0, new->init_cb == NULL ? 1 : 0 );
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
105
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
106 new->depends = dlsym( new->handler, "fd_ext_depends" );
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
107 if (new->depends) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
108 new->ext_name = (char *)new->depends[0];
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
109 new->free_ext_name = 0;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
110 if ( new->depends[1] ) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
111 fd_list_insert_before(&ext_with_depends, &new->chain);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
112 } else {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
113 fd_list_insert_before(&all_extensions, &new->chain);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
114 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
115 } else {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
116 new->ext_name = strdup(basename(dp->d_name));
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
117 new->free_ext_name = 1;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
118 fd_list_insert_before(&all_extensions, &new->chain);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
119 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
120
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
121 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
122 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
123
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
124 /* Now, reorder the list by dependencies */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
125 {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
126 int count, prevcount = 0;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
127 struct fd_list * li;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
128 do {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
129 count = 0;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
130 for (li=ext_with_depends.next; li != &ext_with_depends; li=li->next) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
131 struct ext_info * e = li->o;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
132 int d;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
133 int satisfied=0;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
134
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
135 /* Can we satisfy all dependencies? */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
136 for (d=1; ;d++) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
137 struct fd_list * eli;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
138 if (!e->depends[d]) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
139 satisfied = 1;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
140 break;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
141 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
142
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
143 /* can we find this dependency in the list? */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
144 for (eli=all_extensions.next; eli != &all_extensions; eli = eli->next) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
145 struct ext_info * de = eli->o;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
146 if (!strcasecmp(de->ext_name, e->depends[d]))
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
147 break; /* this dependency is satisfied */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
148 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
149
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
150 if (eli == &all_extensions) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
151 satisfied = 0;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
152 break;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
153 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
154 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
155
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
156 if (satisfied) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
157 /* OK, we have all our dependencies in the list */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
158 li=li->prev;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
159 fd_list_unlink(&e->chain);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
160 fd_list_insert_before(&all_extensions, &e->chain);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
161 } else {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
162 count++;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
163 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
164 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
165
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
166 if (prevcount && (prevcount == count)) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
167 LOG_E("Some extensions cannot have their dependencies satisfied, e.g.: %s", ((struct ext_info *)ext_with_depends.next->o)->ext_name);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
168 CHECK(0, 1);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
169 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
170 prevcount = count;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
171
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
172 if (FD_IS_LIST_EMPTY(&ext_with_depends))
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
173 break;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
174 } while (1);
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
175 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
176
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
177 /* Now, load all the extensions */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
178 {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
179 struct fd_list * li;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
180 for (li=all_extensions.next; li != &all_extensions; li=li->next) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
181 struct ext_info * e = li->o;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
182 int ret = (*e->init_cb)( FD_PROJECT_VERSION_MAJOR, FD_PROJECT_VERSION_MINOR, NULL );
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
183 LOG_N("Initializing extension '%s': %s", e->ext_name, ret ? strerror(ret) : "Success");
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
184 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
185 }
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
186
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
187 /* We should probably clean the list here ? */
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
188 }
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
189
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
190 /* Main test routine */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
191 int main(int argc, char *argv[])
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
192 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
193 struct msg * acr = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
194 unsigned char * buf = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
195
1121
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
196 int dictionaries_loaded = 0;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
197
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
198 test_parameter = DEFAULT_NUMBER_OF_SAMPLES;
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
199
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
200 /* First, initialize the daemon modules */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
201 INIT_FD();
1121
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
202 CHECK( 0, fd_queues_init() );
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
203 CHECK( 0, fd_msg_init() );
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
204 CHECK( 0, fd_rtdisp_init() );
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
205
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
206
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
207 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
208 struct dict_object * acr_model = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
209
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
210 /* Now find the ACR dictionary object */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
211 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Accounting-Request", &acr_model, ENOENT ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
212
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
213 /* Create the instance, using the templates */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
214 CHECK( 0, fd_msg_new ( acr_model, 0, &acr ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
215 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
216
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
217 /* Now let's create some additional Dictionary objects for the test */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
218 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
219 /* The constant values used here are totally arbitrary chosen */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
220 struct dict_object * vendor;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
221 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
222 struct dict_vendor_data vendor_data = { 73565, "Vendor test" };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
223 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data , NULL, &vendor ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
224 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
225
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
226 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
227 struct dict_application_data app_data = { 73566, "Application test" };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
228 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_APPLICATION, &app_data , vendor, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
229 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
230
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
231 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
232 struct dict_avp_data avp_data = { 73567, 0, "AVP Test - no vendor - f32", 0, 0, AVP_TYPE_FLOAT32 };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
233 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_AVP, &avp_data , NULL, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
234 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
235
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
236 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
237 struct dict_avp_data avp_data = { 139103, 0, "AVP Test - no vendor - f64", 0, 0, AVP_TYPE_FLOAT64 };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
238 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_AVP, &avp_data , NULL, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
239 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
240
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
241 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
242 struct dict_object * type = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
243 struct dict_type_data type_data = { AVP_TYPE_INTEGER64, "Int64 test" };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
244 struct dict_avp_data avp_data = { 73568, 73565, "AVP Test - i64", AVP_FLAG_VENDOR, AVP_FLAG_VENDOR, AVP_TYPE_INTEGER64 };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
245 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_TYPE, &type_data , NULL, &type ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
246 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_AVP, &avp_data , type, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
247 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
248
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
249 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
250 struct dict_object * type = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
251 struct dict_type_data type_data = { AVP_TYPE_INTEGER32, "Enum32 test" };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
252 struct dict_enumval_data val1 = { "i32 const test (val 1)", { .i32 = 1 } };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
253 struct dict_enumval_data val2 = { "i32 const test (val 2)", { .i32 = 2 } };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
254 struct dict_enumval_data val3 = { "i32 const test (val -5)",{ .i32 = -5 } };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
255 struct dict_avp_data avp_data = { 73569, 73565, "AVP Test - enumi32", AVP_FLAG_VENDOR, AVP_FLAG_VENDOR, AVP_TYPE_INTEGER32 };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
256
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
257 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_TYPE, &type_data , NULL, &type ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
258 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_AVP, &avp_data , type, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
259 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_ENUMVAL, &val1 , type, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
260 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_ENUMVAL, &val2 , type, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
261 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_ENUMVAL, &val3 , type, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
262 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
263
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
264 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
265 struct dict_object * type = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
266 struct dict_type_data type_data = { AVP_TYPE_OCTETSTRING, "OS test" };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
267 struct dict_avp_data avp_data = { 73570, 73565, "AVP Test - os", AVP_FLAG_VENDOR, AVP_FLAG_VENDOR, AVP_TYPE_OCTETSTRING };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
268 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_TYPE, &type_data , NULL, &type ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
269 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_AVP, &avp_data , type, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
270 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
271
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
272 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
273 struct dict_object * type = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
274 struct dict_type_data type_data = { AVP_TYPE_OCTETSTRING, "OS enum test" };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
275 struct dict_enumval_data val1 = { "os const test (Test)", { .os = { (unsigned char *)"Test", 4 } } };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
276 struct dict_enumval_data val2 = { "os const test (waaad)", { .os = { (unsigned char *)"waaad", 5 } } };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
277 struct dict_enumval_data val3 = { "os const test (waa)", { .os = { (unsigned char *)"waaad", 3 } } };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
278 struct dict_avp_data avp_data = { 73571, 73565, "AVP Test - enumos", AVP_FLAG_VENDOR, AVP_FLAG_VENDOR, AVP_TYPE_OCTETSTRING };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
279
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
280 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_TYPE, &type_data , NULL, &type ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
281 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_AVP, &avp_data , type, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
282 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_ENUMVAL, &val1 , type, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
283 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_ENUMVAL, &val2 , type, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
284 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_ENUMVAL, &val3 , type, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
285 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
286
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
287 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
288 struct dict_object * gavp = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
289 struct dict_avp_data avp_data = { 73572, 73565, "AVP Test - grouped", AVP_FLAG_VENDOR, AVP_FLAG_VENDOR, AVP_TYPE_GROUPED };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
290
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
291 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_AVP, &avp_data , NULL, &gavp ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
292
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
293 /* Macro to search AVP and create a rule */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
294 #define ADD_RULE( _parent, _vendor, _avpname, _pos, _min, _max, _ord ) { \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
295 struct dict_object * _avp = NULL; \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
296 struct dict_avp_request _req = { (_vendor), 0, (_avpname) }; \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
297 struct dict_rule_data _data; \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
298 CHECK( 0, fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME_AND_VENDOR, &_req, &_avp, ENOENT));\
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
299 _data.rule_avp = _avp; \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
300 _data.rule_position = (_pos); \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
301 _data.rule_order = (_ord); \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
302 _data.rule_min = (_min); \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
303 _data.rule_max = (_max); \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
304 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_RULE, &_data , (_parent), NULL ) ); \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
305 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
306
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
307 ADD_RULE(gavp, 73565, "AVP Test - os", RULE_OPTIONAL, -1, -1, 0);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
308
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
309 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
310
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
311 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
312 struct dict_object * application = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
313 struct dict_object * command = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
314 struct dict_cmd_data cmd_data = { 73573, "Test-Command-Request", CMD_FLAG_REQUEST, CMD_FLAG_REQUEST };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
315
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
316 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_APPLICATION, APPLICATION_BY_NAME, "Application test", &application, ENOENT ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
317 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_COMMAND, &cmd_data , application, &command ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
318 ADD_RULE(command, 0, "AVP Test - no vendor - f32", RULE_FIXED_HEAD, -1, 1, 1);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
319 ADD_RULE(command, 73565, "AVP Test - i64", RULE_REQUIRED, -1, -1, 0);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
320 ADD_RULE(command, 73565, "AVP Test - enumi32", RULE_OPTIONAL, -1, -1, 0);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
321 ADD_RULE(command, 73565, "AVP Test - os", RULE_OPTIONAL, -1, -1, 0);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
322 ADD_RULE(command, 73565, "AVP Test - enumos", RULE_OPTIONAL, -1, -1, 0);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
323 ADD_RULE(command, 73565, "AVP Test - grouped", RULE_OPTIONAL, -1, -1, 0);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
324 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
325
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
326 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
327 struct dict_object * application = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
328 struct dict_object * command = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
329 struct dict_cmd_data cmd_data = { 73573, "Test-Command-Answer", CMD_FLAG_REQUEST, 0 };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
330
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
331 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_APPLICATION, APPLICATION_BY_NAME, "Application test", &application, ENOENT ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
332 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_COMMAND, &cmd_data , application, &command ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
333 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
334
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
335 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
336 struct dict_object * gavp = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
337 struct dict_avp_data avp_data = { 73574, 73565, "AVP Test - rules", AVP_FLAG_VENDOR, AVP_FLAG_VENDOR, AVP_TYPE_GROUPED };
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
338
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
339 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_AVP, &avp_data , NULL, &gavp ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
340
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
341 ADD_RULE(gavp, 0, "AVP Test - no vendor - f32", RULE_FIXED_HEAD, 0, 1, 1);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
342 ADD_RULE(gavp, 73565, "AVP Test - i64", RULE_FIXED_HEAD, -1, 1, 2);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
343 ADD_RULE(gavp, 73565, "AVP Test - enumi32", RULE_FIXED_HEAD, -1, 1, 3);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
344 ADD_RULE(gavp, 73565, "AVP Test - os", RULE_REQUIRED, 2, 3, 0);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
345 ADD_RULE(gavp, 73565, "AVP Test - enumos", RULE_OPTIONAL, 0, 1, 0);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
346 ADD_RULE(gavp, 73565, "AVP Test - grouped", RULE_FIXED_TAIL, -1, 1, 1);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
347 /* ABNF :
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
348 < no vendor - f32 >
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
349 < i64 >
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
350 < enumi32 >
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
351 2*3 { os }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
352 *1 [ enumos ]
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
353 < grouped >
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
354 */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
355 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
356 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
357
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
358 /* Now create some values and check the length is correctly handled */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
359 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
360 struct dict_object * cmd_model = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
361 struct msg * msg = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
362 struct dict_object * avp_model = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
363 union avp_value value;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
364
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
365 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Test-Command-Request", &cmd_model, ENOENT ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
366
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
367 /* Check the sizes are handled properly */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
368 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
369 struct avp * avpi = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
370 struct avp * avpch = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
371 struct msg_hdr * msgdata = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
372 #define ADD_AVP( _parent, _position, _avpi, _avpvendor, _avpname) { \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
373 struct dict_object * _avp = NULL; \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
374 struct dict_avp_request _req = { (_avpvendor), 0, (_avpname) }; \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
375 CHECK( 0, fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME_AND_VENDOR, &_req, &_avp, ENOENT));\
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
376 CHECK( 0, fd_msg_avp_new ( _avp, 0, &_avpi ) ); \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
377 CHECK( 0, fd_msg_avp_add ( (_parent), (_position), _avpi ) ); \
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
378 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
379 /* Create a message with many AVP inside */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
380 CHECK( 0, fd_msg_new ( cmd_model, 0, &msg ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
381 CHECK( 0, fd_msg_hdr ( msg, &msgdata ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
382
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
383 /* Avp no vendor, float32 => size = 12 */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
384 ADD_AVP( msg, MSG_BRW_LAST_CHILD, avpi, 0, "AVP Test - no vendor - f32" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
385 value.f32 = 3.1415;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
386 CHECK( 0, fd_msg_avp_setvalue ( avpi, &value ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
387
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
388 /* Add a vendor AVP, integer64 => size = 20 */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
389 ADD_AVP( msg, MSG_BRW_LAST_CHILD, avpi, 73565, "AVP Test - i64" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
390 value.i64 = 0x123456789abcdeLL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
391 CHECK( 0, fd_msg_avp_setvalue ( avpi, &value ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
392
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
393 /* Add an AVP with an enum value */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
394 ADD_AVP( msg, MSG_BRW_LAST_CHILD, avpi, 73565, "AVP Test - enumi32" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
395 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
396 struct dict_object * type_model = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
397 struct dict_object * value_model = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
398 struct dict_enumval_request request;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
399
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
400 CHECK( 0, fd_msg_model ( avpi, &avp_model ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
401 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_TYPE, TYPE_OF_AVP, avp_model, &type_model, ENOENT ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
402 memset(&request, 0, sizeof(request));
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
403 request.type_obj = type_model;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
404 request.search.enum_name = "i32 const test (val 2)";
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
405 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_ENUMVAL, ENUMVAL_BY_STRUCT, &request, &value_model, ENOENT ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
406 CHECK( 0, fd_dict_getval ( value_model, &request.search ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
407 CHECK( 0, fd_msg_avp_setvalue ( avpi, &request.search.enum_value ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
408 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
409
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
410 /* Add an AVP with an enum value, negative */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
411 ADD_AVP( msg, MSG_BRW_LAST_CHILD, avpi, 73565, "AVP Test - enumi32" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
412 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
413 struct dict_object * type_model = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
414 struct dict_object * value_model = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
415 struct dict_enumval_request request;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
416
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
417 CHECK( 0, fd_msg_model ( avpi, &avp_model ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
418 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_TYPE, TYPE_OF_AVP, avp_model, &type_model, ENOENT ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
419 memset(&request, 0, sizeof(request));
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
420 request.type_obj = type_model;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
421 request.search.enum_name = "i32 const test (val -5)";
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
422 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_ENUMVAL, ENUMVAL_BY_STRUCT, &request, &value_model, ENOENT ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
423 CHECK( 0, fd_dict_getval ( value_model, &request.search ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
424 CHECK( 0, fd_msg_avp_setvalue ( avpi, &request.search.enum_value ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
425 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
426
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
427 /* Now add a value which is not a constant into an enumerated AVP */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
428 ADD_AVP( msg, MSG_BRW_LAST_CHILD, avpi, 73565, "AVP Test - enumi32" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
429 value.i32 = -10;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
430 CHECK( 0, fd_msg_avp_setvalue ( avpi, &value ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
431
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
432 /* Add an octetstring AVP */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
433 ADD_AVP( msg, MSG_BRW_LAST_CHILD, avpi, 73565, "AVP Test - os" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
434 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
435 unsigned char buf[90];
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
436 memcpy(&buf, "This\0 is a buffer of dat\a. It is not a string so we can have any c\0ntr\0l character here...\0\0", 89);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
437 value.os.data = buf;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
438 value.os.len = 89;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
439 CHECK( 0, fd_msg_avp_setvalue ( avpi, &value ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
440 memset(&buf, 0, sizeof(buf)); /* Test that the OS value is really copied */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
441 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
442
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
443 /* Add an octetstring from an enumerated constant */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
444 ADD_AVP( msg, MSG_BRW_LAST_CHILD, avpi, 73565, "AVP Test - enumos" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
445 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
446 struct dict_object * type_model = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
447 struct dict_object * value_model = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
448 struct dict_enumval_request request;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
449
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
450 CHECK( 0, fd_msg_model ( avpi, &avp_model ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
451 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_TYPE, TYPE_OF_AVP, avp_model, &type_model, ENOENT ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
452 memset(&request, 0, sizeof(request));
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
453 request.type_obj = type_model;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
454 request.search.enum_name = "os const test (waaad)";
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
455 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_ENUMVAL, ENUMVAL_BY_STRUCT, &request, &value_model, ENOENT ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
456 CHECK( 0, fd_dict_getval ( value_model, &request.search ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
457 CHECK( 0, fd_msg_avp_setvalue ( avpi, &request.search.enum_value ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
458 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
459
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
460 /* Add an octetstring from an enumerated constant */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
461 ADD_AVP( msg, MSG_BRW_LAST_CHILD, avpi, 73565, "AVP Test - enumos" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
462 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
463 struct dict_object * type_model = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
464 struct dict_object * value_model = NULL;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
465 struct dict_enumval_request request;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
466
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
467 CHECK( 0, fd_msg_model ( avpi, &avp_model ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
468 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_TYPE, TYPE_OF_AVP, avp_model, &type_model, ENOENT ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
469 memset(&request, 0, sizeof(request));
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
470 request.type_obj = type_model;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
471 request.search.enum_name = "os const test (waa)";
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
472 CHECK( 0, fd_dict_search ( fd_g_config->cnf_dict, DICT_ENUMVAL, ENUMVAL_BY_STRUCT, &request, &value_model, ENOENT ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
473 CHECK( 0, fd_dict_getval ( value_model, &request.search ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
474 CHECK( 0, fd_msg_avp_setvalue ( avpi, &request.search.enum_value ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
475 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
476
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
477 /* Now test the grouped AVPs */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
478 ADD_AVP( msg, MSG_BRW_LAST_CHILD, avpi, 73565, "AVP Test - grouped" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
479 ADD_AVP( avpi, MSG_BRW_LAST_CHILD, avpch, 73565, "AVP Test - os" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
480 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
481 value.os.data = (unsigned char *)"12345678";
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
482 value.os.len = 8;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
483 CHECK( 0, fd_msg_avp_setvalue ( avpch, &value ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
484 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
485 ADD_AVP( avpi, MSG_BRW_LAST_CHILD, avpch, 73565, "AVP Test - os" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
486 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
487 value.os.data = (unsigned char *)"123456789";
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
488 value.os.len = 9;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
489 CHECK( 0, fd_msg_avp_setvalue ( avpch, &value ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
490 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
491
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
492 /* Add another similar grouped AVP, to have lot of padding */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
493 ADD_AVP( msg, MSG_BRW_LAST_CHILD, avpi, 73565, "AVP Test - grouped" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
494 ADD_AVP( avpi, MSG_BRW_LAST_CHILD, avpch, 73565, "AVP Test - os" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
495 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
496 value.os.data = (unsigned char *)"1";
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
497 value.os.len = 1;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
498 CHECK( 0, fd_msg_avp_setvalue ( avpch, &value ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
499 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
500 ADD_AVP( avpi, MSG_BRW_LAST_CHILD, avpch, 73565, "AVP Test - os" );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
501 {
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
502 value.os.data = (unsigned char *)"1234567";
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
503 value.os.len = 7;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
504 CHECK( 0, fd_msg_avp_setvalue ( avpch, &value ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
505 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
506
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
507 /* Set the application to the test application: 73566 */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
508 msgdata->msg_appl = 73566;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
509
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
510 /* Set the hop-by-hop ID to a random value: 0x4b44b41d */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
511 msgdata->msg_hbhid = 0x4b44b41d;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
512 /* Set the end-to-end ID to a random value: 0xe2ee2e1d */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
513 msgdata->msg_eteid = 0xe2ee2e1d;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
514 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
515
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
516 CHECK( 0, fd_msg_bufferize( msg, &buf, NULL ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
517
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
518 LOG_D( "Test message: %s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, NULL, 0, 1));
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
519
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
520 /* Now free the message, we keep only the buffer. */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
521 CHECK( 0, fd_msg_free( msg ) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
522
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
523 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
524
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
525 /* We have our "buf" now, length is 344 -- cf. testmesg.c. */
1121
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
526 redo:
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
527 /* Test the throughput of the different functions function */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
528 {
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
529 struct stress_struct {
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
530 struct msg * m;
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
531 uint8_t * b;
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
532 } * stress_array;
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
533 int i;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
534 struct timespec start, end;
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
535
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
536 /* Create the copies of the message buffer */
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
537 stress_array = calloc(test_parameter, sizeof(struct stress_struct));
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
538 CHECK( stress_array ? 1 : 0, 1);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
539
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
540 for (i=0; i < test_parameter; i++) {
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
541 stress_array[i].b = malloc(344);
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
542 if (!stress_array[i].b)
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
543 break;
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
544 memcpy(stress_array[i].b, buf, 344);
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
545 }
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
546 CHECK( test_parameter, i ); /* if false, a malloc failed */
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
547
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
548 /* fd_msg_parse_buffer */
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
549
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
550 CHECK( 0, clock_gettime(CLOCK_REALTIME, &start) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
551
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
552 /* Test the msg_parse_buffer function */
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
553 for (i=0; i < test_parameter; i++) {
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
554 if (0 != fd_msg_parse_buffer( &stress_array[i].b, 344, &stress_array[i].m) )
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
555 break;
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
556 }
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
557 CHECK( test_parameter, i ); /* if false, a call failed */
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
558
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
559 CHECK( 0, clock_gettime(CLOCK_REALTIME, &end) );
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
560 display_result(test_parameter, &start, &end, "fd_msg_parse_buffer", "buffers", "parsed");
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
561
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
562 /* fd_msg_parse_dict */
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
563
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
564 CHECK( 0, clock_gettime(CLOCK_REALTIME, &start) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
565
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
566 /* Test the fd_msg_parse_dict function */
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
567 for (i=0; i < test_parameter; i++) {
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
568 if (0 != fd_msg_parse_dict( stress_array[i].m, fd_g_config->cnf_dict, NULL ) )
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
569 break;
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
570 }
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
571 CHECK( test_parameter, i ); /* if false, a call failed */
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
572
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
573 CHECK( 0, clock_gettime(CLOCK_REALTIME, &end) );
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
574 display_result(test_parameter, &start, &end, "fd_msg_parse_dict", "messages", "parsed");
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
575
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
576
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
577 /* fd_msg_parse_rules */
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
578
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
579 CHECK( 0, clock_gettime(CLOCK_REALTIME, &start) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
580
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
581 /* Test the fd_msg_parse_rules function */
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
582 for (i=0; i < test_parameter; i++) {
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
583 if (0 != fd_msg_parse_rules( stress_array[i].m, fd_g_config->cnf_dict, NULL ) )
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
584 break;
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
585 }
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
586 CHECK( test_parameter, i ); /* if false, a call failed */
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
587
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
588 CHECK( 0, clock_gettime(CLOCK_REALTIME, &end) );
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
589 display_result(test_parameter, &start, &end, "fd_msg_parse_rules", "messages", "parsed");
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
590
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
591
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
592 /* fd_msg_new_answer_from_req (0) */
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
593
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
594 CHECK( 0, clock_gettime(CLOCK_REALTIME, &start) );
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
595
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
596 /* Test the fd_msg_new_answer_from_req function */
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
597 for (i=0; i < test_parameter; i++) {
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
598 if (0 != fd_msg_new_answer_from_req( fd_g_config->cnf_dict, &stress_array[i].m, 0 ) )
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
599 break;
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
600 }
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
601 CHECK( test_parameter, i ); /* if false, a call failed */
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
602
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
603 CHECK( 0, clock_gettime(CLOCK_REALTIME, &end) );
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
604 display_result(test_parameter, &start, &end, "new_answer(normal)", "messages", "created");
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
605
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
606 /* unlink answers and go back to request messages */
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
607 for (i=0; i < test_parameter; i++) {
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
608 struct msg * ans = stress_array[i].m;
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
609 if (0 != fd_msg_answ_getq( ans, &stress_array[i].m ) )
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
610 break;
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
611 if (0 != fd_msg_answ_detach( ans ) )
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
612 break;
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
613 fd_msg_free( ans );
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
614 }
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
615 CHECK( test_parameter, i ); /* if false, a call failed */
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
616
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
617
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
618 /* fd_msg_new_answer_from_req (MSGFL_ANSW_ERROR) */
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
619
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
620 CHECK( 0, clock_gettime(CLOCK_REALTIME, &start) );
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
621
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
622 /* Test the fd_msg_new_answer_from_req function */
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
623 for (i=0; i < test_parameter; i++) {
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
624 if ( 0 != fd_msg_new_answer_from_req( fd_g_config->cnf_dict, &stress_array[i].m, MSGFL_ANSW_ERROR ) )
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
625 break;
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
626 }
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
627 CHECK( test_parameter, i ); /* if false, a call failed */
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
628
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
629 CHECK( 0, clock_gettime(CLOCK_REALTIME, &end) );
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
630 display_result(test_parameter, &start, &end, "new_answer(error)", "messages", "created");
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
631
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
632 /* unlink answers and go back to request messages */
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
633 for (i=0; i < test_parameter; i++) {
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
634 struct msg * ans = stress_array[i].m;
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
635 if (0 != fd_msg_answ_getq( ans, &stress_array[i].m ) )
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
636 break;
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
637 if (0 != fd_msg_answ_detach( ans ) )
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
638 break;
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
639 fd_msg_free( ans );
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
640 }
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
641
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
642
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
643 /* fd_msg_bufferize */
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
644
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
645
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
646 CHECK( 0, clock_gettime(CLOCK_REALTIME, &start) );
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
647
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
648 /* Test the fd_msg_bufferize function */
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
649 for (i=0; i < test_parameter; i++) {
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
650 size_t len = 0;
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
651 if (0 != fd_msg_bufferize( stress_array[i].m, &stress_array[i].b, &len ) )
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
652 break;
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
653 }
1093
44f3e48dfe27 Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1090
diff changeset
654 CHECK( test_parameter, i ); /* if false, a call failed */
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
655
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
656 CHECK( 0, clock_gettime(CLOCK_REALTIME, &end) );
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
657 display_result(test_parameter, &start, &end, "fd_msg_bufferize", "buffers", "created");
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
658
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
659
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
660 /* fd_msg_free */
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
661
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
662 CHECK( 0, clock_gettime(CLOCK_REALTIME, &start) );
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
663
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
664 /* Free those messages */
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
665 for (i=0; i < test_parameter; i++) {
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
666 fd_msg_free( stress_array[i].m );
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
667 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
668
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
669 CHECK( 0, clock_gettime(CLOCK_REALTIME, &end) );
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
670 display_result(test_parameter, &start, &end, "fd_msg_free", "messages", "freed");
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
671
1090
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
672
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
673 for (i=0; i < test_parameter; i++) {
8be95f757b08 Improved the testmesg_stress with more functions tested and configurable number of samples.
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
674 free(stress_array[i].b);
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
675 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
676 free(stress_array);
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
677 }
1121
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
678
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
679 if (!dictionaries_loaded) {
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
680 load_all_extensions("dict_");
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
681 dictionaries_loaded = 1;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
682 printf("Loaded all dictionary extensions, restarting...\n");
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
683 goto redo;
ccbd1426e04a Improve testmesg_stress to measure impact of loaded dictionary
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1119
diff changeset
684 }
1076
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
685
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
686 /* That's all for the tests yet */
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
687 PASSTEST();
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
688 }
fcdcb562fea8 New testcase to measure performance of the fd_msg_parse_* functions
Sebastien Decugis <sdecugis@freediameter.net>
parents:
diff changeset
689
"Welcome to our mercurial repository"