[C #] Logger time-consuming method "forward"

Source: Internet
Author: User

System.Diagnostics.Stopwatch Stopwatch = new System.Diagnostics.Stopwatch ();
Stopwatch. Start ();
Here: time-consuming processes/methods need to be calculated
Stopwatch. Stop ();
Stopwatch. Elapsed.totalseconds//Here is the total running seconds of the output, accurate to milliseconds

System.Diagnostics.Stopwatch Stopwatch =NewSystem.Diagnostics.Stopwatch (); Stopwatch. Start ();byte[] A = System.IO.File.ReadAllBytes ("x:\\ new text document. txt"); Textbox2.appendtext ("\ r \ n Load file total length {1} time {0} seconds". Formatwith (stopwatch. Elapsed.totalseconds, A.length)); stopwatch. Reset (); Stopwatch. Start ();byte[] B = LC. Fun.Hash.AES_Encrypt (A,"#[email protected] $DJGJ #1a!2"); Textbox2.appendtext ("\ r \ n Encryption complete length {1} time {0} seconds". Formatwith (stopwatch. Elapsed.totalseconds, B.length)); stopwatch. Reset (); Stopwatch. Start ();byte[] C = LC. Fun.Hash.AES_Decrypt (b,"#[email protected] $DJGJ #1a!2"); Textbox2.appendtext ("\ r \ n Decryption completed total length {1} time {0} seconds". Formatwith (stopwatch. Elapsed.totalseconds, C.length)); stopwatch. Stop (); 

[C #] Logger time-consuming method "forward"

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.