Stopwatch:marshalbyrefobject
{
DateTime mark = DateTime.Now;
public void Start ()
{
Mark = DateTime.Now;
}
public int Stop ()
{
return (int) (Datetime.now-mark). TotalMilliseconds);
}
}
StopwatchServer.cs
Using System;
Using System.Runtime.Remoting;
Using System.Runtime.Remoting.Channels;
Using SYSTEM.RUNTIME.REMOTING.CHANNELS.TCP;
Class MYAPP
{
static void Main ()
{
TcpServerChannel channel = new TcpServerChannel (1234);
ChannelServices.RegisterChannel (channel);
Remotingconfiguration.regis
namespaces: System.DiagnosticsStopwatch Instances can measure the elapsed time of a single time interval, or they can measure the total elapsed time of multiple time intervals. In a typical Stopwatch scenario, call the start method, then call the Stop method, and finally use the Elapsed property to check the run time.The Stopwatch instance is either running or stopped, and isrunning can be used to determine
the database file and obtain the number of IP records, which can be obtained through countQqwry. net.IplocationIP = qqwry. Query ("120.67.217.7");// Query an IP addressConsole. Writeline ("{0} {1} {2 }", IP. IP, IP. Country, IP. Local );
The following is the performance comparison code with iplocation. dll:
1: stopwatch = New stopwatch ();
2: List string IPS = New List string >{" 120.67.2
:
QQWry.NET.QQWryLocator Qqwry = new QQWry.NET.QQWryLocator ("Qqwry.dat")//initializes the database file and obtains the number of IP records, which can be obtained by count
QQWry.NET.IPLocation IP = qqwry.query ("120.67.217.7"); Querying an IP address
Console.WriteLine (' {0} {1} {2} ', IP. IP, IP. Country, IP. local);
The following is the performance comparison code with IPLocation.dll:
Copy Code code as follows:
Stopwat
namespaces: System.DiagnosticsStopwatch Instances can measure the elapsed time of a single time interval, or they can measure the total elapsed time of multiple time intervals. In a typical Stopwatch scenario, call the start method, then call the Stop method, and finally use the Elapsed property to check the run time.The Stopwatch instance is either running or stopped, and isrunning can be used to determine
return statement in which the operand has type TResult.">If your method has a return statement with an operand of type TResult, it is task
Task if your method has no return statement or has a return statement with no operand.">If your method does not return a statement or has a return statement with no operands, it is a Task.
Sub in Visual Basic) if you‘re writing an async event handler.">If you are writing an asynchronous event handler, it is Void (a Sub in Visual Basic).
For more i
. QQWryLocator ("qqwry. dat"); // initialize the database file and obtain the number of IP records, which can be obtained through CountQQWry. NET. IPLocation ip = qqWry. Query ("120.67.217.7"); // Query an ip addressConsole. WriteLine ("{0} {1} {2}", ip. IP, ip. Country, ip. Local );The following is the performance comparison code with IPLocation. dll:Copy codeThe Code is as follows:Stopwatch stopwatch = new Stopw
address: http://delphi.xcjc.net/viewthread.php? Tid = 1570If it is true, the results of the API may not be accurate. 5. Use the. NET system. Diagnostics. Stopwatch class
Recommendation
In the Basic timer mechanism, stopwatch counts the timer scale to measure the running time. If the installed hardware and operating system support high-resolution performance counters, the
C # Run Time of the test code,
You can use the following methods to accurately record the time consumed by code execution.
System. diagnostics. stopwatch stopwatch = new Stopwatch (); stopwatch. start (); // Start to monitor the code running time // you code .... stopwatch
ArticleDirectory
References:
In the previous article "gethashcode", I implemented a new skyiv. Numeric. biginteger. gethashcode method:
Public override intGethashcode (){IntN = sign;For(IntI = data. Length-1; I> = 0; I-= 4 ){IntM = data [I];If(I> 0) M | = (data [I-1] If(I> 1) M | = (data [I-2] If(I> 2) M | = (data [I-3] ReturnN * 0x5d588b65 ;}
the Code is elegant, but the If statements in the blue "> for loop can actually mention for outside the loop, as shown below:
... 104. Stopwatch function Design ... 135, the fixed-point timekeeping function design ... 146. Alarm Clock function design ... 157, Perpetual calendar query function: ... 168. Display function Design ... 19Five, experience ... 212, pre-preparation 1, a number of knowledge of the review of electricityRelated knowledge of gate circuit, counter, trigger, 555 trigger and Karnaugh map. 2, Multisim related knowledge of learningIn addition to the basic op
.]
Use of Thread Pool
Common Methods of thread pool:
public static bool QueueUserWorkItem(WaitCallback callBack, object state);
WaitCallback: the callback method to be executed by the thread pool thread.
[ComVisible(true)]public delegate void WaitCallback(object state);
Sample Code:
ThreadPool. setMaxThreads (12, 12); int workerThreads, completionPortThreads; ThreadPool. getMaxThreads (out workerThreads, out completionPortThreads); Console. writeLine ("Maximum number of auxiliary
1. Practice code full record:usingSystem;usingSystem.Collections.Generic;usingSystem.Diagnostics;usingSystem.Linq;usingSystem.Text;usingSystem.Threading;usingSystem.Threading.Tasks;namespaceawait_ Test {classProgram {Static voidMain (string[] args) {TESTC (); Console.read (); } //Async is contagious as a zombie virus, and async infects the surrounding code until the top level. In fact, we just have to let it go, so that all the code is infected with asynchronous f
This example tries to demonstrate the functionality of parallel processing in the most concise code, which uses single-threaded and multi-threaded operations 5 times in a 1-second time, respectively. Print out the execution process and time-consuming.The following is the sample code, which requires more than 4.0. NET Framework.usingSystem;usingSystem.Collections.Generic;usingSystem.Collections.Concurrent;usingSystem.Diagnostics;usingSystem.Linq;usingSystem.Threading;usingSystem.Threading.Tasks;n
4. Why read a picture so slow?
In general, there are several ways to read a diagram:
1 public static Image FromFile(string filename); 2 public static Image FromFile(string filename, bool useEmbeddedColorManagement); 3 public static Bitmap FromHbitmap(IntPtr hbitmap); 4 public static Bitmap FromHbitmap (IntPtr hbitmap, IntPtr hpalette); 5 public static Image FromStream(Stream stream); 6 public static Image FromStream(Stream stream, bool useEmbeddedColorManagement); 7 public static Image FromStr
Directory
Springapplication instance Run method running procedure
Summarize
"Spring Boot 2.x start the whole process of source analysis (a) Import class analysis" We analyzed the Spring boot entry class Springapplication source code, and know its construction principle, this we continue to analyze its core run method.Springapplication instance Run method running procedureThe above analysis of the Springapplication instance object construction method initialization process, the
, each test code in the code needs to be encapsulated with the PER4J library. Let's first define the number of iterations
Copy Code code as follows:
private static final int outer_iteration=20;
private static final int inner_iteration=50000;
Next, we will use the above 4 methods to implement our test code.
Copy Code code as follows:
String addteststr = "";
String concatteststr = "";
StringBuffer CONCATTESTSB = null;
StringBuilder CONCATTESTSBU =
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.