File: http_performance_common.h

package info (click to toggle)
globus-xio 6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 8,128 kB
  • sloc: ansic: 46,711; sh: 11,139; perl: 1,598; makefile: 289
file content (202 lines) | stat: -rw-r--r-- 5,680 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/*
 * Copyright 1999-2006 University of Chicago
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef HTTP_TEST_COMMON_H
#define HTTP_TEST_COMMON_H

#include "globus_xio.h"
#include "globus_xio_http.h"

#define PINGPONG_MAX_SIZE   1000000
#define THROUGHPUT_MAX_SIZE 1000000
#define START_SIZE 1000000
#define TCP_BUF_SIZE 80000

typedef struct
{
    globus_byte_t *			buffer;			
    globus_size_t			size;
    int					iterations;
    int					temp_iterations;
    int                                 done;
    globus_xio_http_version_t           version;
    char *				contact;
    char *                              transfer_encoding;
    globus_xio_driver_t                 tcp_driver;
    globus_xio_driver_t                 http_driver;
    globus_xio_stack_t                  stack;
}
http_test_info_t;

typedef struct
{
    globus_mutex_t                      mutex;
    globus_cond_t                       cond;

    int                                 outstanding_operation;

    globus_xio_server_t                 server;
    globus_xio_handle_t                 handle;

    char *				contact;
    globus_bool_t                       shutdown;
    globus_bool_t                       shutdown_done;

    globus_hashtable_t                  uri_handlers;
    http_test_info_t *			info;
    globus_xio_driver_t                 http_driver;
}
http_test_server_t;

typedef int
(*pingpong_func_t)(          
    http_test_info_t *	     info,
    int                      timer);

typedef int
(*next_size_func_t)(
    int                       last_size);

typedef void (*globus_xio_http_request_ready_callback_t)(
    void *                              user_arg,
    globus_result_t                     result,
    const char *                        method,
    const char *                        uri,
    globus_xio_http_version_t           http_version,
    globus_hashtable_t                  headers);

typedef struct _performance_s
{
    next_size_func_t         next_size;
    pingpong_func_t	     pingpong;
    char *                   name;
    void *                   user_arg;
    int			     iterations;	
} performance_t;

globus_result_t
http_test_server_init(
    http_test_server_t *                server,
    globus_xio_driver_t                 tcp_driver,
    globus_xio_driver_t                 http_driver,
    globus_xio_stack_t                  stack);

globus_result_t
http_test_server_register_handler(
    http_test_server_t *                server,
    const char *                        uri,
    globus_xio_http_request_ready_callback_t
                                        ready_callback,
    void *                              arg);

globus_result_t
http_test_server_run(
    http_test_server_t *                server);

globus_result_t
http_test_server_shutdown(
    http_test_server_t *                server);

void
http_test_server_destroy(
    http_test_server_t *                server);

globus_result_t
http_test_server_respond(
    http_test_server_t *                server,
    int                                 status_code,
    char *                              reason_phrase,
    globus_xio_http_header_t *          header_array,
    size_t                              header_array_len);

globus_result_t
http_test_server_close_handle(
    http_test_server_t *                test_server);

globus_result_t
http_test_client_request(
    globus_xio_handle_t *               new_handle,
    globus_xio_driver_t                 tcp_driver,
    globus_xio_driver_t                 http_driver,
    globus_xio_stack_t                  stack,
    const char *                        contact,
    const char *                        uri,
    const char *                        method,
    globus_xio_http_version_t           http_version,
    globus_xio_http_header_t *          header_array,
    size_t                              header_array_length);

int
http_test_initialize(
    globus_xio_driver_t *               tcp_driver,
    globus_xio_driver_t *               http_driver,
    globus_xio_stack_t *                stack);

globus_bool_t
http_is_eof(
    globus_result_t                     res);

void
performance_init(
    performance_t *          perf,
    pingpong_func_t	     pingpong,	
    next_size_func_t         next_size,
    int			     iterations,	
    char *                   test_name,
    int			     buf_size);

void
performance_start_slave(
    performance_t *          perf,
    http_test_info_t *       info);

int
performance_start_master(
    performance_t *          perf,
    http_test_info_t *       info);

int
throughput_next_size(
    int                       last_size);

int
pingpong_next_size(
    int                       last_size);

int
pingpong_next_size(
    int                       last_size);

int
throughput_next_size(
    int                       last_size);

void
prep_timers(
    performance_t *           perf,
    char *                    label,
    int                       iterations,
    int			      buf_size);

void
write_timers(
    char *                    label);

void
performance_write_timers(
    performance_t *           perf);

#endif