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

📄 timer.java

📁 Python Development Environment (Python IDE plugin for Eclipse). Features editor, code completion, re
💻 JAVA
字号:
package org.python.pydev.core.performanceeval;

/**
 * This class is a helper in performance evaluation
 */
public class Timer {

	private long start;

	public Timer(){
		this.start = System.currentTimeMillis();
	}

	public void printDiffMillis() {
		System.out.println("Time Elapsed (millis):"+getDiff());
	}
	
	public void printDiff() {
		printDiff(null);
	}

	private long getDiff() {
		long old = this.start;
		long newStart = System.currentTimeMillis();
		long diff = (newStart-old);
		start = newStart;
		return diff;
	}

	public void printDiff(String msg) {
		double secs = getDiff()/1000.0d;
		if(msg != null){
			System.out.println("Time Elapsed for:"+msg+" (secs):"+secs);
		}else{
			System.out.println("Time Elapsed (secs):"+secs);
		}
	}
}

⌨️ 快捷键说明

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