Grid Community Toolkit  6.2.1653033972 (tag: v6.2.20220524)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
http_performance_common.h
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef HTTP_TEST_COMMON_H
18 #define HTTP_TEST_COMMON_H
19 
20 #include "globus_xio.h"
21 #include "globus_xio_http.h"
22 
23 #define PINGPONG_MAX_SIZE 1000000
24 #define THROUGHPUT_MAX_SIZE 1000000
25 #define START_SIZE 1000000
26 #define TCP_BUF_SIZE 80000
27 
28 typedef struct
29 {
30  globus_byte_t * buffer;
31  globus_size_t size;
32  int iterations;
33  int temp_iterations;
34  int done;
36  char * contact;
37  char * transfer_encoding;
38  globus_xio_driver_t tcp_driver;
39  globus_xio_driver_t http_driver;
40  globus_xio_stack_t stack;
41 }
42 http_test_info_t;
43 
44 typedef struct
45 {
46  globus_mutex_t mutex;
47  globus_cond_t cond;
48 
49  int outstanding_operation;
50 
51  globus_xio_server_t server;
52  globus_xio_handle_t handle;
53 
54  char * contact;
55  globus_bool_t shutdown;
56  globus_bool_t shutdown_done;
57 
58  globus_hashtable_t uri_handlers;
59  http_test_info_t * info;
60  globus_xio_driver_t http_driver;
61 }
62 http_test_server_t;
63 
64 typedef int
65 (*pingpong_func_t)(
66  http_test_info_t * info,
67  int timer);
68 
69 typedef int
70 (*next_size_func_t)(
71  int last_size);
72 
73 typedef void (*globus_xio_http_request_ready_callback_t)(
74  void * user_arg,
75  globus_result_t result,
76  const char * method,
77  const char * uri,
78  globus_xio_http_version_t http_version,
79  globus_hashtable_t headers);
80 
81 typedef struct _performance_s
82 {
83  next_size_func_t next_size;
84  pingpong_func_t pingpong;
85  char * name;
86  void * user_arg;
87  int iterations;
88 } performance_t;
89 
91 http_test_server_init(
92  http_test_server_t * server,
93  globus_xio_driver_t tcp_driver,
94  globus_xio_driver_t http_driver,
95  globus_xio_stack_t stack);
96 
98 http_test_server_register_handler(
99  http_test_server_t * server,
100  const char * uri,
101  globus_xio_http_request_ready_callback_t
102  ready_callback,
103  void * arg);
104 
106 http_test_server_run(
107  http_test_server_t * server);
108 
110 http_test_server_shutdown(
111  http_test_server_t * server);
112 
113 void
114 http_test_server_destroy(
115  http_test_server_t * server);
116 
118 http_test_server_respond(
119  http_test_server_t * server,
120  int status_code,
121  char * reason_phrase,
122  globus_xio_http_header_t * header_array,
123  size_t header_array_len);
124 
126 http_test_server_close_handle(
127  http_test_server_t * test_server);
128 
130 http_test_client_request(
131  globus_xio_handle_t * new_handle,
132  globus_xio_driver_t tcp_driver,
133  globus_xio_driver_t http_driver,
134  globus_xio_stack_t stack,
135  const char * contact,
136  const char * uri,
137  const char * method,
138  globus_xio_http_version_t http_version,
139  globus_xio_http_header_t * header_array,
140  size_t header_array_length);
141 
142 int
143 http_test_initialize(
144  globus_xio_driver_t * tcp_driver,
145  globus_xio_driver_t * http_driver,
146  globus_xio_stack_t * stack);
147 
149 http_is_eof(
150  globus_result_t res);
151 
152 void
153 performance_init(
154  performance_t * perf,
155  pingpong_func_t pingpong,
156  next_size_func_t next_size,
157  int iterations,
158  char * test_name,
159  int buf_size);
160 
161 void
162 performance_start_slave(
163  performance_t * perf,
164  http_test_info_t * info);
165 
166 int
167 performance_start_master(
168  performance_t * perf,
169  http_test_info_t * info);
170 
171 int
172 throughput_next_size(
173  int last_size);
174 
175 int
176 pingpong_next_size(
177  int last_size);
178 
179 int
180 pingpong_next_size(
181  int last_size);
182 
183 int
184 throughput_next_size(
185  int last_size);
186 
187 void
188 prep_timers(
189  performance_t * perf,
190  char * label,
191  int iterations,
192  int buf_size);
193 
194 void
195 write_timers(
196  char * label);
197 
198 void
199 performance_write_timers(
200  performance_t * perf);
201 
202 #endif
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
Globus XIO HTTP Driver Header.
Mutex.
Definition: globus_thread.h:107
HTTP Header.
Definition: globus_xio_http.h:132
Condition variable.
Definition: globus_thread.h:124
size_t globus_size_t
Standard size of memory objectThe globus_size_t is the size of a memory object. It is identical to si...
Definition: globus_types.h:48
unsigned char globus_byte_t
Unsigned byte datatypeThis is used for byte-addressable arrays of arbitrary data which is not subject...
Definition: globus_types.h:85
uint32_t globus_result_t
Definition: globus_types.h:99
globus_xio_http_version_t
Definition: globus_xio_http.h:231