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

📄 tracetoslog2.java

📁 fortran并行计算包
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        }        else {            slog_outs.close();            dobj_ins.close();            System.err.println( "Error: No drawable is found in the trace "                              + trace_filespec );            File slog_file  = new File( slog_filename );            if ( slog_file.isFile() && slog_file.exists() ) {                System.err.println( "       Removing the remnants of the file "                                  + slog_filename + " ....." );                slog_file.delete();            }            System.exit( 1 );        }        /* */    Date time3 = new Date();        System.out.println( "\n" );        System.out.println( "Number of Drawables = " + Nobjs );        // System.out.println( "time1 = " + time1 + ", " + time1.getTime() );        // System.out.println( "time2 = " + time2 + ", " + time2.getTime() );        // System.out.println( "time3 = " + time3 + ", " + time3.getTime() );        System.out.println( "timeElapsed between 1 & 2 = "                          + ( time2.getTime() - time1.getTime() ) + " msec" );        System.out.println( "timeElapsed between 2 & 3 = "                          + ( time3.getTime() - time2.getTime() ) + " msec" );    }    private static int parseByteSize( String size_str )    {        int idxOfKilo = Math.max( size_str.indexOf( 'k' ),                                  size_str.indexOf( 'K' ) );        int idxOfMega = Math.max( size_str.indexOf( 'm' ),                                  size_str.indexOf( 'M' ) );        if ( idxOfKilo > 0 )            return Integer.parseInt( size_str.substring( 0, idxOfKilo ) )                   * 1024;        else if ( idxOfMega > 0 )            return Integer.parseInt( size_str.substring( 0, idxOfMega ) )                   * 1024 * 1024;        else            return Integer.parseInt( size_str );    }    private static String help_msg = "Usage: java slog2.output.TraceToSlog2 "                                   + "[options] trace_filename.\n"                                   + " options: \n"                                   + "\t [-h|--h|-help|--help]             "                                   + "\t Display HELP message.\n"                                   + "\t [-tc]                             "                                   + "\t Check increasing endtime order,\n"                                   + "\t                                   "                                   + "\t exit when 1st violation occurs.\n"                                   + "\t [-tcc]                            "                                   + "\t Check increasing endtime order,\n"                                   + "\t                                   "                                   + "\t continue when violations occur.\n"                                   + "\t [-nc number_of_children_per_node] "                                   + "\t Default value is "                                   + logformat.slog2.Const.NUM_LEAFS +".\n"                                   + "\t [-ls max_byte_size_of_leaf_node]  "                                   + "\t Default value is "                                   + logformat.slog2.Const.LEAF_BYTESIZE +".\n"                                   + "\t [-o output_filename_with_slog2_suffix]"                                   + "\n\n"                                   + " note: \"max_byte_size_of_leaf_node\" "                                   + "can be specified with suffix "                                   + "k, K, m or M,\n"                                   + "       where k or K stands for kilobyte,"                                   + " m or M stands for megabyte.\n"                                   + "       e.g. 64k means 65536 bytes.\n";    private static void parseCmdLineArgs( String argv[] )    {        String        arg_str;        int           idx;        StringBuffer  err_msg       = new StringBuffer();        StringBuffer  filespec_buf  = new StringBuffer();        enable_endtime_check     = false;        continue_when_violation  = false;        if ( argv.length == 0 ) {            System.out.println( help_msg );            filespec_buf.append(  "-h " );        }        idx = 0;        try {            while ( idx < argv.length ) {                if ( argv[ idx ].startsWith( "-" ) ) {                    if (  argv[ idx ].equals( "-h" )                        || argv[ idx ].equals( "--h" )                       || argv[ idx ].equals( "-help" )                       || argv[ idx ].equals( "--help" ) ) {                        System.out.println( help_msg );                        filespec_buf.append(  "-h " );                        idx++;                    }                    else if ( argv[ idx ].equals( "-tc" ) ) {                        enable_endtime_check     = true;                        continue_when_violation  = false;                        err_msg.append( "\n endtime_order_check_exit = true" );                        idx++;                    }                    else if ( argv[ idx ].equals( "-tcc" ) ) {                        enable_endtime_check     = true;                        continue_when_violation  = true;                        err_msg.append( "\n endtime_order_check_stay = true" );                        idx++;                    }                    else if ( argv[ idx ].equals( "-nc" ) ) {                        arg_str = argv[ ++idx ];                         num_children_per_node = Short.parseShort( arg_str );                        err_msg.append( "\n number_of_children_per_node = "                                      + arg_str );                        idx++;                    }                    else if ( argv[ idx ].equals( "-ls" ) ) {                        arg_str = argv[ ++idx ];                        leaf_bytesize = parseByteSize( arg_str );                        err_msg.append( "\n max_byte_size_of_leaf_node = "                                      + arg_str );                        idx++;                    }                    else if ( argv[ idx ].equals( "-o" ) ) {                        slog_filename = argv[ ++idx ].trim();                        err_msg.append( "\n output_filename = "                                      + slog_filename );                        idx++;                        if ( ! slog_filename.endsWith( ".slog2" ) )                            System.err.println( "Warning: The suffix of the "                                              + "output filename is NOT "                                              + "\".slog2\"." );                    }                    else {                        filespec_buf.append( argv[ idx ] + " " );                        idx++;                    }                }                else {                    filespec_buf.append( argv[ idx ] + " " );                    idx++;                }            }        } catch ( ArrayIndexOutOfBoundsException idxerr ) {            if ( err_msg.length() > 0 )                System.err.println( err_msg.toString() );            System.err.println( "Error occurs after option "                              + argv[ idx-1 ] + ", " + indexOrderStr( idx )                              + " command line argument." );            // System.err.println( help_msg );            idxerr.printStackTrace();        } catch ( NumberFormatException numerr ) {            if ( err_msg.length() > 0 )                System.err.println( err_msg.toString() );            String idx_order_str = indexOrderStr( idx );            System.err.println( "Error occurs after option "                              + argv[ idx-1 ] + ", " + indexOrderStr( idx )                              + " command line argument.  It needs a number." );            // System.err.println( help_msg );            numerr.printStackTrace();        }                trace_filespec = filespec_buf.toString().trim();        if ( trace_filespec == null ) {            System.err.println( "This program needs a TRACE file specification "                              + "string as part of the command line arguments."                              );            System.err.println( help_msg );            System.exit( 1 );        }    }    private static String indexOrderStr( int idx )    {        switch (idx) {            case 1  : return Integer.toString( idx ) + "st";            case 2  : return Integer.toString( idx ) + "nd";            case 3  : return Integer.toString( idx ) + "rd";            default : return Integer.toString( idx ) + "th";        }    }}

⌨️ 快捷键说明

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