serverlog.java

来自「主要考察的是资源池的设计和实现」· Java 代码 · 共 20 行

JAVA
20
字号
package ServerImpl;
import java.io.BufferedWriter;
public class ServerLog {
  private int hitcount=0,count=0,samples;
  private String type;
  public ServerLog(String _type,int _s){
	samples = _s;
	type = _type;
  }

  public  void Record(boolean ishit){
      ++count;
      if(ishit)++hitcount;
      if(count==samples){
		  System.out.println(type+" Hit percent");
          System.out.println("Hit Count"+hitcount+" "+ hitcount*100.0/samples+"%");
          count=0;hitcount=0;
      }      
  }
}

⌨️ 快捷键说明

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