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

📄 slog_threadinfos.java

📁 MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程环境.
💻 JAVA
字号:
import java.util.*;import java.io.*;public class SLOG_ThreadInfos implements Serializable{    private Vector threads;    public SLOG_ThreadInfos()    {        threads = new Vector();    }    public SLOG_ThreadInfos( int Nelem )    {        threads = new Vector( Nelem );    }    public SLOG_ThreadInfos( RandomAccessFile file_stm )    throws IOException    {        threads = new Vector();        this.ReadFromRandomFile( file_stm );    }    public SLOG_ThreadInfos( RandomAccessFile file_stm, long fileloc )    throws IOException    {        file_stm.seek( fileloc );        threads = new Vector();        this.ReadFromRandomFile( file_stm );    }    public SLOG_ThreadInfo EntryAt( int idx )    throws ArrayIndexOutOfBoundsException    {        try {            return( (SLOG_ThreadInfo) threads.elementAt( idx ) );        }        catch ( ArrayIndexOutOfBoundsException e ) {            return null;        }    }    public int NumOfThreads()    {        return threads.size();    }    public int GetOSprocessID( short in_node_id, int in_thread_id )    throws IndexOutOfBoundsException    {        SLOG_ThreadInfo  thread;        Enumeration enum = threads.elements();        while( enum.hasMoreElements() ) {            thread = (SLOG_ThreadInfo) enum.nextElement();            if (    thread.node_id   == in_node_id                 && thread.thread_id == in_thread_id )                return thread.OSprocess_id;        }        throw new IndexOutOfBoundsException( in_node_id + ", " + in_thread_id );    }    public int GetOSthreadID( short in_node_id, int in_thread_id )    throws IndexOutOfBoundsException    {        SLOG_ThreadInfo  thread;        Enumeration enum = threads.elements();        while( enum.hasMoreElements() ) {            thread = (SLOG_ThreadInfo) enum.nextElement();            if (    thread.node_id   == in_node_id                 && thread.thread_id == in_thread_id )                return thread.OSthread_id;        }        throw new IndexOutOfBoundsException( in_node_id + ", " + in_thread_id );    }    public int GetAppID( short in_node_id, int in_thread_id )    throws IndexOutOfBoundsException    {        SLOG_ThreadInfo  thread;        Enumeration enum = threads.elements();        while( enum.hasMoreElements() ) {            thread = (SLOG_ThreadInfo) enum.nextElement();            if (    thread.node_id   == in_node_id                 && thread.thread_id == in_thread_id )                return thread.app_id;        }        throw new IndexOutOfBoundsException( in_node_id + ", " + in_thread_id );    }    public void ReadFromRandomFile( RandomAccessFile file_stm )    throws IOException    {        int Nelem = file_stm.readInt();        for ( int ii = 0; ii < Nelem; ii++ ) {            SLOG_ThreadInfo thread = new SLOG_ThreadInfo();            thread.ReadFromRandomFile( file_stm );            threads.addElement( thread );        }    }    public void WriteToRandomFile( RandomAccessFile file_stm )    throws IOException    {        Enumeration enum = threads.elements();        while( enum.hasMoreElements() )            ( (SLOG_ThreadInfo) enum.nextElement() )            .WriteToRandomFile( file_stm );    }    public String toString()    {        StringBuffer rep = new StringBuffer( "ThreadInfos[] = \n" );        Enumeration enum = threads.elements();        while( enum.hasMoreElements() )            rep.append( (SLOG_ThreadInfo) enum.nextElement() + "\n" );        return( rep.toString() );    }}

⌨️ 快捷键说明

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