| 224 | |
| 225 | template<typename P> |
| 226 | static void perf_get_info(FB_API_HANDLE* handle, P* perf) |
| 227 | { |
| 228 | /************************************** |
| 229 | * |
| 230 | * P E R F _ g e t _ i n f o |
| 231 | * |
| 232 | ************************************** |
| 233 | * |
| 234 | * Functional description |
| 235 | * Acquire timing and performance information. Some info comes |
| 236 | * from the system and some from the database. |
| 237 | * |
| 238 | **************************************/ |
| 239 | SSHORT buffer_length, item_length; |
| 240 | ISC_STATUS_ARRAY jrd_status; |
| 241 | #ifdef HAVE_GETTIMEOFDAY |
| 242 | struct timeval tp; |
| 243 | #else |
| 244 | struct timeb time_buffer; |
| 245 | #define LARGE_NUMBER 696600000 // to avoid overflow, get rid of decades) |
| 246 | #endif |
| 247 | |
| 248 | // If there isn't a database, zero everything out |
| 249 | |
| 250 | if (!*handle) { |
| 251 | memset(perf, 0, sizeof(PERF)); |
| 252 | } |
| 253 | |
| 254 | // Get system time |
| 255 | |
| 256 | times(&perf->perf_times); |
| 257 | |
| 258 | #ifdef HAVE_GETTIMEOFDAY |
| 259 | GETTIMEOFDAY(&tp); |
| 260 | perf->perf_elapsed = tp.tv_sec * 100 + tp.tv_usec / 10000; |
| 261 | #else |
| 262 | ftime(&time_buffer); |
| 263 | perf->perf_elapsed = (time_buffer.time - LARGE_NUMBER) * 100 + (time_buffer.millitm / 10); |
| 264 | #endif |
| 265 | |
| 266 | if (!*handle) |
| 267 | return; |
| 268 | |
| 269 | SCHAR buffer[256]; |
| 270 | buffer_length = sizeof(buffer); |
| 271 | item_length = sizeof(items); |
| 272 | isc_database_info(jrd_status, handle, item_length, items, buffer_length, buffer); |
| 273 | |
| 274 | const char* p = buffer; |
| 275 | |
| 276 | while (true) |
| 277 | switch (*p++) |
| 278 | { |
| 279 | case isc_info_reads: |
| 280 | perf->perf_reads = get_parameter(&p); |
| 281 | break; |
| 282 | |
| 283 | case isc_info_writes: |
nothing calls this directly
no test coverage detected