27{
29 char *event,
str[256];
36
37 setbuf(stdout, NULL);
38 setbuf(stderr, NULL);
39
40
41
42 printf("ID of event to produce: ");
45
46 printf("Host to connect: ");
48
49 printf("Event size: ");
53 variable_size = 1;
55 } else
56 variable_size = 0;
57
58 printf("RPC mode ([0]/1): ");
61
62
65 return 1;
66
67
69
70
72
73
76 if (event == NULL) {
77 printf("Not enough memory for event buffer\n");
78 goto error;
79 }
81
82 do {
85
86 do {
87 for (
i = 0;
i < 10;
i++) {
88 if (variable_size)
90 else
92
93
94
95
96 pdata[0] = act_size;
97 pdata[act_size / 4 - 1] = act_size;
98
99
102
103 if (act_size < 0)
104 printf(
"Error: act_size = %d, size = %d\n", act_size,
event_size);
105
106
108
110 printf("rpc_send_event returned error %d, event_size %d\n",
112 goto error;
113 }
114
116 }
117
118
120
121
123 if (stop != start)
124 rate =
count / 1024.0 / 1024.0 / (stop / 1000.0 - start / 1000.0);
125 else
126 rate = 0;
127
128
131 if (size <= 0)
132 size += buffer_header.
size;
133 printf(
"Level: %5.1lf %%, ", 100 - 100.0 * size / buffer_header.
size);
134
135 printf("Rate: %1.2lf MB/sec\n", rate);
136
137
138 if ((flush++) % 10 == 0) {
141 printf("flush\n");
142 }
143
145
147
148 error:
149
151 return 1;
152}
INT bm_open_buffer(const char *buffer_name, INT buffer_size, INT *buffer_handle)
INT bm_set_cache_size(INT buffer_handle, size_t read_size, size_t write_size)
INT bm_compose_event(EVENT_HEADER *event_header, short int event_id, short int trigger_mask, DWORD data_size, DWORD serial)
INT bm_flush_cache(int buffer_handle, int timeout_msec)
INT cm_yield(INT millisec)
INT cm_connect_experiment(const char *host_name, const char *exp_name, const char *client_name, void(*func)(char *))
INT cm_disconnect_experiment(void)
char * ss_gets(char *string, int size)
INT rpc_send_event(INT buffer_handle, const EVENT_HEADER *pevent, int unused, INT async_flag, INT mode)
char host_name[HOST_NAME_LENGTH]
INT bm_get_buffer_info(INT buffer_handle, BUFFER_HEADER *buffer_header)
#define EVENT_BUFFER_NAME