StopWatch, c # stopwatch

Source: Internet
Author: User

StopWatch, c # stopwatch




1 package com; 2 3 import java. io. fileInputStream; 4 import java. io. inputStream; 5 import java. rmi. naming; 6 import java. util. list; 7 import java. util. map; 8 import java. util. map. entry; 9 import org.apache.commons.exe c. util. mapUtils; 10 import org. apache. poi. ss. usermodel. cell; 11 import org. apache. poi. ss. usermodel. sheet; 12 import org. apache. poi. ss. usermodel. workbook; 13 import org. apache. poi. ss. usermo Del. workbookFactory; 14 import org. junit. before; 15 import org. junit. ignore; 16 import org. junit. test; 17 import org. springframework. util. stopWatch; 18 19 import com. alibaba. fastjson. JSONObject; 20 import com. gemantic. wealth. application. model. fixProduct; 21 import com. gemantic. wealth. application. model. recommendFootHc; 22 import com. gemantic. wealth. application. service. fixProductService; 23 import com. gemant Ic. wealth. application. service. recommendFootHcService; 24 import com. google. common. collect. maps; 25/** 26 * Old yinxing debt product maintenance, please do not delete 27 * @ author PZhang 28 * @ date Creation Time: 2:05:46 29 * @ version 1.030 */31 // @ Ignore32 public class ReadByMan {33 public static void main (String [] args) {34 try {35 StopWatch sw = new StopWatch ("TestWatch"); 36 sw. start ("c0"); 37 String key = "702410"; 38 Map <String, String> ElementBase = Maps. newHashMap (); 39 elementBase. put ("day base", "365"); 40 elementBase. put ("start date of interest calculation", "1462237200000"); 41 elementBase. put ("interest calculation deadline", "1543971600000"); 42 elementBase. put ("days before interest payment", "90,181,272,364,455,546,637,729"); 43 elementBase. put ("income distribution method", "1"); 44 sw. stop (); 45 sw. start ("c1"); 46 if (ReadExcel. writeDB (elementBase, key) {47 System. out. print (key + "successful! "); 48} else {49 System. out. print (key +" failed! "); 50} 51 System. out. println (sw. isRunning (); 52 sw. stop (); 53 System. out. println (sw. prettyPrint (); 54 System. out. println (sw. getTaskCount (); 55 System. out. println (sw. getLastTaskName (); 56 System. out. println (sw. isRunning (); 57 System. out. println (sw. shortSummary (); 58 System. out. println (sw. getLastTaskInfo (). getTaskName (); 59 System. out. println (sw. getTaskInfo () [0]. getTaskName (); 60} catch (Exception e) {61 e. printStackTrace (); 62} 63} 64 65}
The output result is :##########################
702410 successful! TrueStopWatch 'testwatch ': running time (millis) = 411 milliseconds ms % Task name timeout 00011 003% c000400 097% c12c1falseStopWatch 'testwatch': running time (millis) = 411c1c0

Summary:

Import com. google. common. base. Stopwatch;

Import org. apache. commons. lang3.time. StopWatch;

Import org. springframework. util. StopWatch;

Timestamp used for performance testing. stopwatch can be provided by three different jar packages in different ways. Simple and Convenient;

Springframework. util. StopWatch works best and is recommended.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.