Changeset 8821
- Timestamp:
- 04/26/11 17:00:09 (2 years ago)
- Location:
- branches/Orange-Branch/src
- Files:
-
- 5 modified
-
common/misc/pint-perf-counter.c (modified) (17 diffs)
-
common/misc/pint-perf-counter.h (modified) (3 diffs)
-
proto/endecode-funcs.h (modified) (2 diffs)
-
server/perf-mon.sm (modified) (16 diffs)
-
server/perf-update.sm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/Orange-Branch/src/common/misc/pint-perf-counter.c
r6268 r8821 80 80 /* allocate time arrays */ 81 81 pc->start_time_array_ms = 82 (uint64_t*)malloc(PERF_DEFAULT_HISTORY_SIZE*sizeof(uint64_t));82 (uint64_t*)malloc(PERF_DEFAULT_HISTORY_SIZE*sizeof(uint64_t)); 83 83 if(!pc->start_time_array_ms) 84 84 { … … 88 88 } 89 89 pc->interval_array_ms = 90 (uint64_t*)malloc(PERF_DEFAULT_HISTORY_SIZE*sizeof(uint64_t));90 (uint64_t*)malloc(PERF_DEFAULT_HISTORY_SIZE*sizeof(uint64_t)); 91 91 if(!pc->interval_array_ms) 92 92 { … … 97 97 } 98 98 memset(pc->start_time_array_ms, 0, 99 PERF_DEFAULT_HISTORY_SIZE*sizeof(uint64_t));99 PERF_DEFAULT_HISTORY_SIZE*sizeof(uint64_t)); 100 100 memset(pc->interval_array_ms, 0, 101 PERF_DEFAULT_HISTORY_SIZE*sizeof(uint64_t));101 PERF_DEFAULT_HISTORY_SIZE*sizeof(uint64_t)); 102 102 103 103 /* allocate value matrix */ … … 115 115 { 116 116 pc->value_matrix[i] = 117 (int64_t*)malloc(pc->history_size*sizeof(int64_t));117 (int64_t*)malloc(pc->history_size*sizeof(int64_t)); 118 118 if(!pc->value_matrix[i]) 119 119 { … … 154 154 /* zero out all fields */ 155 155 memset(pc->start_time_array_ms, 0, 156 PERF_DEFAULT_HISTORY_SIZE*sizeof(uint64_t));156 PERF_DEFAULT_HISTORY_SIZE*sizeof(uint64_t)); 157 157 memset(pc->interval_array_ms, 0, 158 PERF_DEFAULT_HISTORY_SIZE*sizeof(uint64_t));158 PERF_DEFAULT_HISTORY_SIZE*sizeof(uint64_t)); 159 159 for(i=0; i<pc->key_count; i++) 160 160 { … … 179 179 */ 180 180 void PINT_perf_finalize( 181 struct PINT_perf_counter* pc) /**< pointer to counter instance */181 struct PINT_perf_counter* pc) /**< pointer to counter instance */ 182 182 { 183 183 int i; … … 201 201 * \see PINT_perf_count macro 202 202 */ 203 void __PINT_perf_count( 204 struct PINT_perf_counter* pc, 205 int key, 206 int64_t value, 207 enum PINT_perf_ops op) 203 void __PINT_perf_count( struct PINT_perf_counter* pc, 204 int key, 205 int64_t value, 206 enum PINT_perf_ops op) 208 207 { 209 208 if(!pc) … … 247 246 * rolls over the current history window 248 247 */ 249 void PINT_perf_rollover( 250 struct PINT_perf_counter* pc) 248 void PINT_perf_rollover( struct PINT_perf_counter* pc) 251 249 { 252 250 int i; … … 271 269 { 272 270 memmove(&pc->value_matrix[i][1], &pc->value_matrix[i][0], 273 ((pc->history_size-1)*sizeof(int64_t)));271 ((pc->history_size-1)*sizeof(int64_t))); 274 272 } 275 273 memmove(&pc->interval_array_ms[1], &pc->interval_array_ms[0], 276 ((pc->history_size-1)*sizeof(uint64_t)));274 ((pc->history_size-1)*sizeof(uint64_t))); 277 275 memmove(&pc->start_time_array_ms[1], &pc->start_time_array_ms[0], 278 ((pc->history_size-1)*sizeof(uint64_t)));276 ((pc->history_size-1)*sizeof(uint64_t))); 279 277 if(int_time > pc->start_time_array_ms[1]) 280 278 { … … 305 303 * \returns 0 on success, -PVFS_error on failure 306 304 */ 307 int PINT_perf_set_info( 308 struct PINT_perf_counter* pc, 309 enum PINT_perf_option option, 310 unsigned int arg) 305 int PINT_perf_set_info( struct PINT_perf_counter* pc, 306 enum PINT_perf_option option, 307 unsigned int arg) 311 308 { 312 309 uint64_t* tmp_unsigned; … … 335 332 */ 336 333 PINT_PERF_REALLOC_ARRAY(pc, 337 tmp_unsigned,338 pc->start_time_array_ms,339 arg,340 uint64_t);334 tmp_unsigned, 335 pc->start_time_array_ms, 336 arg, 337 uint64_t); 341 338 PINT_PERF_REALLOC_ARRAY(pc, 342 tmp_unsigned,343 pc->interval_array_ms,344 arg,345 uint64_t);339 tmp_unsigned, 340 pc->interval_array_ms, 341 arg, 342 uint64_t); 346 343 for(i=0; i<pc->key_count; i++) 347 344 { 348 345 PINT_PERF_REALLOC_ARRAY(pc, 349 tmp_signed,350 pc->value_matrix[i],351 arg,352 int64_t);346 tmp_signed, 347 pc->value_matrix[i], 348 arg, 349 int64_t); 353 350 } 354 351 pc->history_size = arg; … … 368 365 * \returns 0 on success, -PVFS_error on failure 369 366 */ 370 int PINT_perf_get_info( 371 struct PINT_perf_counter* pc, 372 enum PINT_perf_option option, 373 unsigned int* arg) 367 int PINT_perf_get_info( struct PINT_perf_counter* pc, 368 enum PINT_perf_option option, 369 unsigned int* arg) 374 370 { 375 371 if(!pc) … … 401 397 */ 402 398 void PINT_perf_retrieve( 403 struct PINT_perf_counter* pc,/**< performance counter */404 int64_t** value_matrix, /**< 2d matrix to fill in with measurements */405 uint64_t* start_time_array_ms,/**< array of start times */406 uint64_t* interval_array_ms,/**< array of interval lengths */407 int max_key,/**< max key value (1st dimension) */408 int max_history)/**< max history (2nd dimension) */399 struct PINT_perf_counter* pc, /**< performance counter */ 400 int64_t** value_matrix, /**< 2d matrix to fill in with measurements */ 401 uint64_t* start_time_array_ms, /**< array of start times */ 402 uint64_t* interval_array_ms, /**< array of interval lengths */ 403 int max_key, /**< max key value (1st dimension) */ 404 int max_history) /**< max history (2nd dimension) */ 409 405 { 410 406 int i; … … 451 447 { 452 448 memcpy(value_matrix[i], pc->value_matrix[i], 453 (tmp_max_history*sizeof(int64_t)));449 (tmp_max_history*sizeof(int64_t))); 454 450 } 455 451 memcpy(start_time_array_ms, pc->start_time_array_ms, 456 (tmp_max_history*sizeof(uint64_t)));452 (tmp_max_history*sizeof(uint64_t))); 457 453 memcpy(interval_array_ms, pc->interval_array_ms, 458 (tmp_max_history*sizeof(uint64_t)));454 (tmp_max_history*sizeof(uint64_t))); 459 455 460 456 gen_mutex_unlock(&pc->mutex); … … 471 467 } 472 468 473 char* PINT_perf_generate_text( 474 struct PINT_perf_counter* pc, 475 int max_size) 469 char* PINT_perf_generate_text( struct PINT_perf_counter* pc, 470 int max_size) 476 471 { 477 472 int total_size = 0; … … 522 517 position += 10; 523 518 sprintf(position, ".%03u", 524 (unsigned)(pc->start_time_array_ms[i]%1000));519 (unsigned)(pc->start_time_array_ms[i]%1000)); 525 520 position += 4; 526 521 } … … 554 549 position += 10; 555 550 sprintf(position, ".%03u", 556 (unsigned)(pc->interval_array_ms[i]%1000));551 (unsigned)(pc->interval_array_ms[i]%1000)); 557 552 position += 4; 558 553 } -
branches/Orange-Branch/src/common/misc/pint-perf-counter.h
r6268 r8821 13 13 14 14 enum { 15 PERF_DEFAULT_TIME_INTERVAL_SECS = 300,16 PERF_DEFAULT_HISTORY_SIZE = 6,15 PERF_DEFAULT_TIME_INTERVAL_SECS = 300, 16 PERF_DEFAULT_HISTORY_SIZE = 6, 17 17 }; 18 18 … … 76 76 77 77 struct PINT_perf_counter* PINT_perf_initialize( 78 struct PINT_perf_key* key_array);78 struct PINT_perf_key* key_array); 79 79 80 80 void PINT_perf_finalize( 81 struct PINT_perf_counter* pc);81 struct PINT_perf_counter* pc); 82 82 83 83 void PINT_perf_reset( 84 struct PINT_perf_counter* pc);84 struct PINT_perf_counter* pc); 85 85 86 86 void __PINT_perf_count( 87 struct PINT_perf_counter* pc,88 int key,89 int64_t value,90 enum PINT_perf_ops op);87 struct PINT_perf_counter* pc, 88 int key, 89 int64_t value, 90 enum PINT_perf_ops op); 91 91 92 92 #ifdef __PVFS2_DISABLE_PERF_COUNTERS__ … … 97 97 98 98 void PINT_perf_rollover( 99 struct PINT_perf_counter* pc);99 struct PINT_perf_counter* pc); 100 100 101 101 int PINT_perf_set_info( 102 struct PINT_perf_counter* pc,103 enum PINT_perf_option option,104 unsigned int arg);102 struct PINT_perf_counter* pc, 103 enum PINT_perf_option option, 104 unsigned int arg); 105 105 106 106 int PINT_perf_get_info( 107 struct PINT_perf_counter* pc,108 enum PINT_perf_option option,109 unsigned int* arg);107 struct PINT_perf_counter* pc, 108 enum PINT_perf_option option, 109 unsigned int* arg); 110 110 111 111 void PINT_perf_retrieve( 112 struct PINT_perf_counter* pc,113 int64_t** value_matrix,114 uint64_t* start_time_array_ms,115 uint64_t* interval_array_ms,116 int max_key,117 int max_history);112 struct PINT_perf_counter* pc, 113 int64_t** value_matrix, 114 uint64_t* start_time_array_ms, 115 uint64_t* interval_array_ms, 116 int max_key, 117 int max_history); 118 118 119 119 char* PINT_perf_generate_text( 120 struct PINT_perf_counter* pc,121 int max_size);120 struct PINT_perf_counter* pc, 121 int max_size); 122 122 123 123 #endif /* __PINT_PERF_COUNTER_H */ -
branches/Orange-Branch/src/proto/endecode-funcs.h
r8317 r8821 88 88 u_int32_t len = 0; \ 89 89 if (*pbuf) \ 90 len = strlen(*pbuf); \90 len = strlen(*pbuf); \ 91 91 *(u_int32_t *) *(pptr) = htobmi32(len); \ 92 92 if (len) { \ 93 memcpy(*(pptr)+4, *pbuf, len+1); \94 int pad = roundup8(4 + len + 1) - (4 + len + 1); \95 *(pptr) += roundup8(4 + len + 1); \96 memset(*(pptr)-pad, 0, pad); \93 memcpy(*(pptr)+4, *pbuf, len+1); \ 94 int pad = roundup8(4 + len + 1) - (4 + len + 1); \ 95 *(pptr) += roundup8(4 + len + 1); \ 96 memset(*(pptr)-pad, 0, pad); \ 97 97 } else { \ 98 *(u_int32_t *) (*(pptr)+4) = 0; \99 *(pptr) += 8; \98 *(u_int32_t *) (*(pptr)+4) = 0; \ 99 *(pptr) += 8; \ 100 100 } \ 101 101 } while (0) … … 104 104 u_int32_t len = 0; \ 105 105 if (*pbuf) \ 106 len = strlen(*pbuf); \106 len = strlen(*pbuf); \ 107 107 *(u_int32_t *) *(pptr) = htobmi32(len); \ 108 108 if (len) { \ 109 memcpy(*(pptr)+4, *pbuf, len+1); \110 *(pptr) += roundup8(4 + len + 1); \109 memcpy(*(pptr)+4, *pbuf, len+1); \ 110 *(pptr) += roundup8(4 + len + 1); \ 111 111 } else { \ 112 *(u_int32_t *) *(pptr) = 0; \113 *(pptr) += 8; \112 *(u_int32_t *) *(pptr) = 0; \ 113 *(pptr) += 8; \ 114 114 } \ 115 115 } while (0) -
branches/Orange-Branch/src/server/perf-mon.sm
r6621 r8821 30 30 machine pvfs2_perf_mon_sm 31 31 { 32 state prelude33 {34 jump pvfs2_prelude_sm;35 default => do_work;36 }37 38 state do_work39 {40 run perf_mon_do_work;41 default => final_response;42 }43 44 state final_response45 {46 jump pvfs2_final_response_sm;47 default => cleanup;48 }49 50 state cleanup51 {52 run perf_mon_cleanup;53 default => terminate;54 }32 state prelude 33 { 34 jump pvfs2_prelude_sm; 35 default => do_work; 36 } 37 38 state do_work 39 { 40 run perf_mon_do_work; 41 default => final_response; 42 } 43 44 state final_response 45 { 46 jump pvfs2_final_response_sm; 47 default => cleanup; 48 } 49 50 state cleanup 51 { 52 run perf_mon_cleanup; 53 default => terminate; 54 } 55 55 } 56 56 … … 67 67 struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); 68 68 if(s_op->resp.u.mgmt_perf_mon.perf_array) 69 free(s_op->resp.u.mgmt_perf_mon.perf_array);69 free(s_op->resp.u.mgmt_perf_mon.perf_array); 70 70 71 71 return(server_state_machine_complete(smcb)); … … 95 95 /* allocate memory to hold statistics */ 96 96 s_op->resp.u.mgmt_perf_mon.perf_array 97 = (struct PVFS_mgmt_perf_stat*)malloc(s_op->req->u.mgmt_perf_mon.count * 98 sizeof(struct PVFS_mgmt_perf_stat)); 97 = (struct PVFS_mgmt_perf_stat*)malloc( 98 s_op->req->u.mgmt_perf_mon.count * 99 sizeof(struct PVFS_mgmt_perf_stat)); 99 100 if(!s_op->resp.u.mgmt_perf_mon.perf_array) 100 101 { 101 js_p->error_code = -PVFS_ENOMEM;102 return SM_ACTION_COMPLETE;102 js_p->error_code = -PVFS_ENOMEM; 103 return SM_ACTION_COMPLETE; 103 104 } 104 105 … … 106 107 gettimeofday(&tv, NULL); 107 108 s_op->resp.u.mgmt_perf_mon.cur_time_ms = tv.tv_sec*1000 + 108 tv.tv_usec/1000;109 tv.tv_usec/1000; 109 110 s_op->resp.u.mgmt_perf_mon.suggested_next_id 110 = s_op->req->u.mgmt_perf_mon.next_id;111 = s_op->req->u.mgmt_perf_mon.next_id; 111 112 s_op->resp.u.mgmt_perf_mon.perf_array_count 112 = s_op->req->u.mgmt_perf_mon.count;113 = s_op->req->u.mgmt_perf_mon.count; 113 114 114 115 /* make sure we have scratch memory to use as an intermediate buffer for … … 125 126 126 127 PINT_perf_retrieve(PINT_server_pc, 127 static_value_matrix,128 static_start_time_array_ms,129 static_interval_array_ms,130 static_key_count,131 static_history_size);128 static_value_matrix, 129 static_start_time_array_ms, 130 static_interval_array_ms, 131 static_key_count, 132 static_history_size); 132 133 133 134 /* work through start times, and find the oldest one that is new enough … … 149 150 */ 150 151 if(tmp_next_id != 0 && 151 ((tmp_next_id >= s_op->req->u.mgmt_perf_mon.next_id) || 152 ((s_op->req->u.mgmt_perf_mon.next_id-tmp_next_id)>(MAX_NEXT_ID/2)))) 152 ((tmp_next_id >= s_op->req->u.mgmt_perf_mon.next_id) || 153 ((s_op->req->u.mgmt_perf_mon.next_id-tmp_next_id) > 154 (MAX_NEXT_ID/2)))) 153 155 { 154 156 /* found the first valid timestamp */ … … 159 161 tmp_next_id = 0; 160 162 tmp_next_id += (uint32_t)(static_start_time_array_ms[0] % 161 MAX_NEXT_ID);163 MAX_NEXT_ID); 162 164 tmp_next_id += 1; 163 165 s_op->resp.u.mgmt_perf_mon.suggested_next_id = tmp_next_id; … … 181 183 s_op->resp.u.mgmt_perf_mon.perf_array[idx].valid_flag = 1; 182 184 s_op->resp.u.mgmt_perf_mon.perf_array[idx].id = 0; 183 s_op->resp.u.mgmt_perf_mon.perf_array[idx].id +=184 (uint32_t)(static_start_time_array_ms[i] % 1000000000);185 s_op->resp.u.mgmt_perf_mon.perf_array[idx].id += 186 (uint32_t)(static_start_time_array_ms[i] % 1000000000); 185 187 s_op->resp.u.mgmt_perf_mon.perf_array[idx].start_time_ms = 186 static_start_time_array_ms[i];188 static_start_time_array_ms[i]; 187 189 s_op->resp.u.mgmt_perf_mon.perf_array[idx].read = 188 static_value_matrix[PINT_PERF_READ][i];190 static_value_matrix[PINT_PERF_READ][i]; 189 191 s_op->resp.u.mgmt_perf_mon.perf_array[idx].write = 190 static_value_matrix[PINT_PERF_WRITE][i];192 static_value_matrix[PINT_PERF_WRITE][i]; 191 193 s_op->resp.u.mgmt_perf_mon.perf_array[idx].metadata_read = 192 static_value_matrix[PINT_PERF_METADATA_READ][i];194 static_value_matrix[PINT_PERF_METADATA_READ][i]; 193 195 s_op->resp.u.mgmt_perf_mon.perf_array[idx].metadata_write = 194 static_value_matrix[PINT_PERF_METADATA_WRITE][i];196 static_value_matrix[PINT_PERF_METADATA_WRITE][i]; 195 197 s_op->resp.u.mgmt_perf_mon.perf_array[idx].dspace_queue = 196 static_value_matrix[PINT_PERF_METADATA_DSPACE_OPS][i];198 static_value_matrix[PINT_PERF_METADATA_DSPACE_OPS][i]; 197 199 s_op->resp.u.mgmt_perf_mon.perf_array[idx].keyval_queue = 198 static_value_matrix[PINT_PERF_METADATA_KEYVAL_OPS][i];200 static_value_matrix[PINT_PERF_METADATA_KEYVAL_OPS][i]; 199 201 } 200 202 else … … 208 210 { 209 211 s_op->resp.u.mgmt_perf_mon.end_time_ms = 210 static_start_time_array_ms[0] +211 static_interval_array_ms[0];212 static_start_time_array_ms[0] + 213 static_interval_array_ms[0]; 212 214 } 213 215 … … 232 234 /* how many keys and history intervals do we have in the perf counter? */ 233 235 ret = PINT_perf_get_info(PINT_server_pc, PINT_PERF_KEY_COUNT, 234 &key_count);236 &key_count); 235 237 if(ret < 0) 236 238 { … … 238 240 } 239 241 ret = PINT_perf_get_info(PINT_server_pc, PINT_PERF_HISTORY_SIZE, 240 &history_size);242 &history_size); 241 243 if(ret < 0) 242 244 { … … 257 259 /* reallocate time arrays */ 258 260 static_start_time_array_ms = 259 (uint64_t*)malloc(history_size*sizeof(uint64_t));261 (uint64_t*)malloc(history_size*sizeof(uint64_t)); 260 262 if(!static_start_time_array_ms) 261 263 { … … 263 265 } 264 266 static_interval_array_ms = 265 (uint64_t*)malloc(history_size*sizeof(uint64_t));267 (uint64_t*)malloc(history_size*sizeof(uint64_t)); 266 268 if(!static_interval_array_ms) 267 269 { … … 271 273 272 274 /* the key count shouldn't change once acquired */ 273 assert((static_key_count == 0) ||(key_count == static_key_count));275 assert((static_key_count == 0) || (key_count == static_key_count)); 274 276 275 277 /* allocate value matrix */ … … 277 279 { 278 280 static_value_matrix = 279 (int64_t**)malloc(key_count*sizeof(int64_t*));281 (int64_t**)malloc(key_count*sizeof(int64_t*)); 280 282 if(!static_value_matrix) 281 283 { … … 290 292 { 291 293 static_value_matrix[i] = 292 (int64_t*)malloc(history_size*sizeof(int64_t));294 (int64_t*)malloc(history_size*sizeof(int64_t)); 293 295 if(!static_value_matrix[i]) 294 296 { -
branches/Orange-Branch/src/server/perf-update.sm
r6617 r8821 94 94 /* post another timer */ 95 95 return(job_req_sched_post_timer(user_opts->perf_update_interval, 96 smcb,97 0,98 js_p,99 &tmp_id,100 server_job_context));96 smcb, 97 0, 98 js_p, 99 &tmp_id, 100 server_job_context)); 101 101 } 102 102
