| 349 | | trc_print_tmask( tmask ) |
| 350 | | Pvmtmask tmask; |
| 351 | | { |
| 352 | | static int indices[ TEV_MAX + 1 ];
|
| 353 | | |
| 354 | | static int ncols = -1; |
| 355 | | static int nrows = -1; |
| 356 | | static int ntev = -1; |
| 357 | | |
| 358 | | static char fmt[64]; |
| 359 | | |
| 360 | | int i, j, k; |
| 361 | | int maxlen; |
| 362 | | int width; |
| 363 | | int index; |
| 364 | | int flag; |
| 365 | | int len; |
| 366 | | int b; |
| 367 | | int c; |
| 368 | | int x; |
| 369 | | |
| 370 | | if ( ntev == -1 ) |
| 371 | | { |
| 372 | | maxlen = -1; |
| 373 | | |
| 374 | | x = 0; |
| 375 | | |
| 376 | | for ( i=TEV_FIRST ; i <= TEV_MAX ; i++ )
|
| 377 | | { |
| 378 | | |
| 379 | | |
| 380 | | if ( strcmp( pvmtevinfo[i].name, "newtask" ) |
| 381 | | && strcmp( pvmtevinfo[i].name, "spntask" ) |
| 382 | | && strcmp( pvmtevinfo[i].name, "endtask" ) |
| 383 | | && strcmp( pvmtevinfo[i].name, "timing" ) |
| 384 | | && strcmp( pvmtevinfo[i].name, "profiling" ) ) |
| 385 | | { |
| 386 | | |
| 387 | | |
| 388 | | len = strlen( pvmtevinfo[i].name ); |
| 389 | | |
| 390 | | if ( len > maxlen || maxlen == -1 ) |
| 391 | | maxlen = len; |
| 392 | | |
| 393 | | |
| 394 | | |
| 395 | | flag = 0; |
| 396 | | |
| 397 | | for ( j=0 ; j < x && !flag ; j++ ) |
| 398 | | { |
| 399 | | if ( strcmp( pvmtevinfo[i].name, |
| 400 | | pvmtevinfo[ indices[j] ].name ) < 0 ) |
| 401 | | { |
| 402 | | for ( k=x+1 ; k > j ; k-- ) |
| 403 | | indices[k] = indices[k - 1]; |
| 404 | | |
| 405 | | indices[j] = i; |
| 406 | | |
| 407 | | x++; |
| 408 | | |
| 409 | | flag++; |
| 410 | | } |
| 411 | | } |
| 412 | | |
| 413 | | if ( !flag ) |
| 414 | | indices[x++] = i; |
| 415 | | } |
| 416 | | } |
| 417 | | |
| 418 | | ntev = x; |
| 419 | | |
| 420 | | maxlen += 4; |
| 421 | | |
| 422 | | ncols = 79 / maxlen; |
| 423 | | |
| 424 | | width = (79 / ncols) - 4; |
| 425 | | |
| 426 | | sprintf( fmt, " %%c %%-%ds%%c", width ); |
| 427 | | |
| 428 | | nrows = ( ntev + ncols - 1 ) / ncols; |
| 429 | | } |
| 430 | | |
| 431 | | for ( i=0 ; i < nrows ; i++ ) |
| 432 | | { |
| 433 | | for ( c=0 ; c < ncols ; c++ ) |
| 434 | | { |
| 435 | | index = i + (c * nrows); |
| 436 | | |
| 437 | | if ( index < ntev ) |
| 438 | | { |
| 439 | | x = indices[ index ]; |
| 440 | | |
| 441 | | b = TEV_MASK_CHECK( tmask, x );
|
| 442 | | |
| 443 | | printf( fmt, (b ? '*' : ' '), pvmtevinfo[x].name, |
| 444 | | (c == ncols - 1 ? '\n' : ' ') ); |
| 445 | | } |
| 446 | | |
| 447 | | else |
| 448 | | printf( "\n" ); |
| 449 | | } |
| 450 | | } |
| 451 | | } |