| 154 | } |
| 155 | |
| 156 | int main (void) { |
| 157 | unsigned int size; |
| 158 | int i; |
| 159 | unsigned int res; |
| 160 | |
| 161 | qb_log_init("cpgbench", LOG_USER, LOG_EMERG); |
| 162 | qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_FALSE); |
| 163 | qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, |
| 164 | QB_LOG_FILTER_FILE, "*", LOG_DEBUG); |
| 165 | qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE); |
| 166 | |
| 167 | size = 64; |
| 168 | signal (SIGALRM, sigalrm_handler); |
| 169 | res = cpg_initialize (&handle, &callbacks); |
| 170 | if (res != CS_OK) { |
| 171 | printf ("cpg_initialize failed with result %d\n", res); |
| 172 | exit (1); |
| 173 | } |
| 174 | pthread_create (&thread, NULL, dispatch_thread, NULL); |
| 175 | |
| 176 | res = cpg_join (handle, &group_name); |
| 177 | if (res != CS_OK) { |
| 178 | printf ("cpg_join failed with result %d\n", res); |
| 179 | exit (1); |
| 180 | } |
| 181 | |
| 182 | for (i = 0; i < 10; i++) { /* number of repetitions - up to 50k */ |
| 183 | cpg_benchmark (handle, size); |
| 184 | signal (SIGALRM, sigalrm_handler); |
| 185 | size *= 5; |
| 186 | if (size >= (ONE_MEG - 100)) { |
| 187 | break; |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | res = cpg_finalize (handle); |
| 192 | if (res != CS_OK) { |
| 193 | printf ("cpg_finalize failed with result %d\n", res); |
| 194 | exit (1); |
| 195 | } |
| 196 | return (0); |
| 197 | } |
nothing calls this directly
no test coverage detected