⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trace_check_timeorder.c

📁 fortran并行计算包
💻 C
📖 第 1 页 / 共 2 页
字号:
                strcpy( offended_rec, offending_rec );                prev_dobj_etime = curr_dobj_etime;            }            break;        case TRACE_PRIMITIVE_DRAWABLE:            /* Find the space needed */            tcoord_sz = 0;            ycoord_sz = 0;            info_sz   = 0;            ierr = TRACE_Peek_next_primitive( tf, &stime, &etime,                                              &tcoord_sz, &ycoord_sz,                                              &info_sz );            if ( ierr != 0 ) {                fprintf( stderr, "Error: %s\n", TRACE_Get_err_string( ierr ) );                fflush( stderr );                exit( 1 );            }            /* Allocate the space, then get the shape */            tcoord_pos = 0;            ycoord_pos = 0;            info_pos   = 0;            ierr = TRACE_Get_next_primitive( tf, &type_idx,                                             &tcoord_sz, tcoord_base,                                             &tcoord_pos, MAX_TIME_COORDS,                                             &ycoord_sz, ycoord_base,                                             &ycoord_pos, MAX_VERT_COORDS,                                             &info_sz, info_base,                                             &info_pos, MAX_INFO_LEN );            if ( ierr != 0 ) {                fprintf( stderr, "Error: %s\n", TRACE_Get_err_string( ierr ) );                fflush( stderr );                exit( 1 );            }            obj_no++;            rec_sz = sprintf( offending_rec,                              "%ld : Primitive: index=%d times=(%lf, %lf) ",                              obj_no, type_idx, stime, etime );            for ( idx = 0; idx < tcoord_sz; idx++ )                rec_sz += sprintf( &(offending_rec[ rec_sz ]),                                   "(%lf, %d) ",                                   tcoord_base[idx], ycoord_base[idx] );            sprintf( &(offending_rec[ rec_sz ]), "info_sz=%d", info_sz );            if ( stime > etime ) {                printf( "**** Violation of Causality ****\n" );                printf( "Offending Drawable -> %s\n", offending_rec );                printf( "\t starttime (%lf) > endtime (%lf)\n",                        stime, etime );                exit( 1 );            }            curr_dobj_etime = etime;            if ( prev_dobj_etime > curr_dobj_etime ) {                printf( "**** Violation of Increasing Endtime Order ****\n" );                printf( "Offended  Drawable -> %s\n", offended_rec );                printf( "Offending Drawable -> %s\n", offending_rec );                printf( "\t previous endtime (%lf) > current endtime (%lf)\n",                        prev_dobj_etime, curr_dobj_etime );                exit( 1 );            }            else {                strcpy( offended_rec, offending_rec );                prev_dobj_etime = curr_dobj_etime;            }            for ( idx = 0; idx < tcoord_sz; idx++ ) {                tcoord = tcoord_base[ idx ];                if ( tcoord < stime || tcoord > etime ) {                    printf( "**** Out of Primitive Time Range ****\n" );                    printf( "Offending Drawable -> %s\n", offending_rec );                    printf( "\t time coordinate %d is out of the range "                            "(%lf,%lf)\n", idx, stime, etime );                    exit( 1 );                }            }            break;        case TRACE_CATEGORY:            /* Find the space needed */            legend_sz     = 0;            label_sz      = 0;            methodIDs_sz  = 0;            ierr = TRACE_Peek_next_category( tf,                                             &legend_sz, &label_sz,                                             &methodIDs_sz );            if ( ierr != 0 ) {                fprintf( stderr, "Error: %s\n", TRACE_Get_err_string( ierr ) );                fflush( stderr );                exit( 1 );            }            /* Allocate the space, then get the Category */            label_pos     = 0;            legend_pos    = 0;            methodID_pos  = 0;            ierr = TRACE_Get_next_category( tf, &type_hdr,                                            &legend_sz, legend_base,                                            &legend_pos, MAX_LEGEND_LEN,                                            &label_sz, label_base,                                            &label_pos, MAX_LABEL_LEN,                                            &methodIDs_sz, methodID_base,                                            &methodID_pos, MAX_METHODS );            if ( ierr != 0 ) {                fprintf( stderr, "Error: %s\n", TRACE_Get_err_string( ierr ) );                fflush( stderr );                exit( 1 );            }            legend_base[ legend_pos ]  = '\0';            label_base[ label_pos ]    = '\0';            printf( "Category: index=%d shape=%d color=(%d,%d,%d,%d) width=%d "                    "legend=%s ", type_hdr.index, type_hdr.shape,                    type_hdr.red, type_hdr.green, type_hdr.blue, type_hdr.alpha,                    type_hdr.width, legend_base );            if ( label_sz > 0 && label_pos > 0 )                printf( "label=< %s > ", label_base );            if ( methodIDs_sz > 0 ) {                printf( "methods={ " );                for ( idx = 0; idx < methodIDs_sz; idx++ )                    printf( "%d ", methodID_base[ idx ] );                printf( "}" );            }            printf( "\n" );            break;        case TRACE_YCOORDMAP:            /* Find the space needed */            nrows            = 0;            ncolumns         = 0;            max_column_name  = 0;            max_title_name   = 0;            methodIDs_sz     = 0;            ierr = TRACE_Peek_next_ycoordmap( tf, &nrows, &ncolumns,                                              &max_column_name,                                              &max_title_name,                                              &methodIDs_sz );            if ( ierr != 0 ) {                fprintf( stderr, "Error: %s\n", TRACE_Get_err_string( ierr ) );                fflush( stderr );                exit( 1 );            }            fprintf( stderr, "max_column_name = %d, max_title_name = %d\n",                             max_column_name, max_title_name );            /* Allocate the space, then get the YCoordMap */            title_name    = (char *) malloc( max_title_name * sizeof(char) );            column_names  = (char **) malloc( (ncolumns-1) * sizeof(char *) );            for ( icol = 0; icol < ncolumns-1; icol++ )                column_names[ icol ] = (char *) malloc( max_column_name                                                      * sizeof(char) );            coordmap_max  = nrows * ncolumns;            coordmap_base = (int *) malloc( coordmap_max * sizeof( int ) );            coordmap_sz   = 0;            coordmap_pos  = 0;            methodID_pos  = 0;            ierr = TRACE_Get_next_ycoordmap( tf, title_name, column_names,                                             &coordmap_sz, coordmap_base,                                             &coordmap_pos, coordmap_max,                                             &methodIDs_sz, methodID_base,                                             &methodID_pos, MAX_METHODS );            if ( ierr != 0 ) {                fprintf( stderr, "Error: %s\n", TRACE_Get_err_string( ierr ) );                fflush( stderr );                exit( 1 );            }            /* Print the YCoordMap */            printf( "YCoordMap: %s[%d][%d]\n", title_name, nrows, ncolumns );            printf( "LineID -> " );            for ( icol = 0; icol < ncolumns-1; icol++ )                printf( "%s ", column_names[ icol ] );            printf( "\n" );            idx = 0;            for ( irow = 0; irow < nrows; irow++ ) {                printf( "%d -> ", coordmap_base[ idx++ ] );                for ( icol = 1; icol < ncolumns; icol++ )                    printf( "%d ", coordmap_base[ idx++ ] );                printf( "\n" );            }            if ( methodIDs_sz > 0 ) {                printf( "methods={ " );                for ( idx = 0; idx < methodIDs_sz; idx++ )                    printf( "%d ", methodID_base[ idx ] );                printf( "}\n" );            }            /* Release the allocated memory */            for ( icol = 0; icol < ncolumns-1; icol++ )                free( column_names[ icol ] );            free( column_names );            column_names = NULL;            free( title_name );            title_name = NULL;            break;        default:            fprintf( stderr, "unknown TRACE_Rec_Kind_t\n" );            fflush( stderr );            exit( 1 );        }        ierr = TRACE_Peek_next_kind( tf, &next_kind );        if ( ierr != 0 ) {            fprintf( stderr, "Error: %s\n", TRACE_Get_err_string( ierr ) );            fflush( stderr );            exit( 1 );        }    }    ierr = TRACE_Close( &tf );    if ( ierr != 0 ) {        fprintf( stderr, "Error: %s\n", TRACE_Get_err_string( ierr ) );        fflush( stderr );        exit( 1 );    }    return 0;}/*static TRACE_boolean_t IsIncreasingEndTimes( double *prev_dobj_etime,                                             double *curr_dobj_etime );static TRACE_boolean_t IsIncreasingEndTimes( double *prev_dobj_etime,                                             double *curr_dobj_etime ){    if ( *prev_dobj_etime > *curr_dobj_etime ) {        printf( "**** Violation of Increasing Endtime Order ****\n" );        printf( "\t previous endtime (%lf) > current endtime (%lf)\n",                *prev_dobj_etime, *curr_dobj_etime );        return TRACE_false;    }    *prev_dobj_etime = *curr_dobj_etime;    return TRACE_true;}*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -