java统计程序运行的时间
耗时统计
long startTime = System.currentTimeMillis(); //获取开始时间
doSomething();
long endTime = System.currentTimeMillis(); //获取结束时间
System.out.println("程序运行时间:" + (endTime - startTime) + "ms");
第二种是以纳秒为单位计算的。
long startTime=System.nanoTime(); //获取开始时间
doSomeThing();
long endTime=System.nanoTime(); //获取结束时间
System.out.println("程序运行时间: "+(endTime-startTime)+"ns");
java统计程序运行的时间的更多相关文章
- 监测程序运行的时间,stopWatch
ArrayList arrInt = new ArrayList(); //用stopwatch来计时 运行的时间 Stopwatch watch = new Stopwatch(); watch.S ...
- Java多线程-程序运行堆栈分析
class文件内容 class文件包含JAVA程序执行的字节码:数据严格按照格式紧凑排列在class文件中的二进制流,中间无任何分隔符:文件开头有一个0xcafebabe(16进制)特殊的一个标志. ...
- 《Java程序代理器》- java桌面程序运行的前端启动框架
虽说让java直接在桌面运行,有很多方法,但最简单的还是有个exe双击执行 要java执行就得有虚拟机,但原本的虚拟机文件体积太大,不方便随同打包,精简的虚拟机功能又不全,指不定什么时候报错 所以正规 ...
- 在win下,如何用bat看程序运行的时间
上网搜了下用bat记录程序运行时间的方法,结果连google跳出的都是些什么ctime啥的- - 一点都不靠谱 傍晚问了几个大神,也大多都是ctime党,不过还好明哲造![跪跪跪] 在此mark 就比 ...
- Java统计程序运行时间
代码如下: 第一种是以毫秒为单位计算的. long startTime = System.currentTimeMillis(); //获取开始时间 doSomething(); //测试 ...
- linux设置程序运行超时时间
在某些情况下,我们需要限制程序的运行时间(比如cronjob等),这里简单介绍下使用信号及timeout的实现方法 1. 假如有如下代码(test_timout.sh): #!/bin/bash wh ...
- 最简单的记录程序运行时间的方法:[记录PHP程序运行消耗时间]
比较实用的debug方法:具体参考地址已经记不清了,这里重写成类方便调用 /** * @author logonmy@126.com * @Date: 13-7-23 * @desc example ...
- jodatime 计算时间差_统计程序运行耗时
https://blog.csdn.net/De_Moivre/article/details/79775661 记录开始执行的时间 DateTime startDateTime=new DateTi ...
- R语言记录程序运行的时间
f <- function(start_time) { start_time <- as.POSIXct(start_time) dt <- difftime(Sys.time(), ...
随机推荐
- Classifying plankton with deep neural networks
Classifying plankton with deep neural networks The National Data Science Bowl, a data science compet ...
- 国内静态文件CDN服务介绍 国内js公共库
国内静态文件CDN服务介绍 新浪SAE 介绍页 文件页 百度云 介绍页 七牛云存储介绍页 优势,可以提交没有的库,支持https,但证书不可信. 又拍云 介绍页 建议使用阿里云OSS自己上传所需文件 ...
- ZOJ 3603 Draw Something Cheat
点我看题目 题意 : 给你n个字符串,让你找出在每个字符串中出现的字母,按字典序输出来. 思路 :一开始想差了,以为记录下每个字符出现次数,然后找次数大于1的,可是我忘了可能在一个字符串中有AA,而另 ...
- PYTHON多进程编码结束之进程池POOL
结束昨晚开始的测试. 最后一个POOL. A,使用POOL的返回结果 #coding: utf-8 import multiprocessing import time def func(msg): ...
- edx 配置smtp发送邮件
参考文章:https://github.com/CDOT-EDX/ProductionStackDocs/wiki/Enable-SMTP-for-EDX-(Production-Stack) 具体到 ...
- Ember.js demo1
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-1 ...
- Linux 启动参数介绍
Linux 启动参数介绍 取自2.6.18 kernel Documentation/i386/boot.txt 文件中介绍 vga= 这里的不是一个整数(在C语言表示法中,应是十进制,八进制或者十六 ...
- plsql exist和in 的区别
<![endif]--> <![endif]--> 发现公司同事很喜欢用exists 和in 做子查询关联,我觉得很有必要研究下 两者的区别,供参考和备忘 /* (这段信息来自 ...
- IPv6 tutorial – Part 5: Address types and global unicast addresses
https://4sysops.com/archives/ipv6-tutorial-part-5-address-types-and-global-unicast-addresses/ In my ...
- USACO3.25Magic Squares(bfs)
/* ID: shangca2 LANG: C++ TASK: msquare */ #include <iostream> #include<cstdio> #include ...