• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 性能測試之如何獲取網頁相應時間

    發表于:2009-04-17來源:作者:點擊數: 標簽:性能測試網頁獲取時間
    性能測試之如何獲取網頁相應時間 前一段時間,為了測試的需要,需要編寫一個多線程的程序,就是最大限度的訪問某個網頁上認證標簽,以獲得大概該認證標簽每秒鐘能響應多少次,于是搜索了一些網上的資料,于是編寫了下面的這個程序,雖然這個程序不是我們使用

    性能測試之如何獲取網頁相應時間

    前一段時間,為了測試的需要,需要編寫一個多線程的程序,就是最大限度的訪問某個網頁上認證標簽,以獲得大概該認證標簽每秒鐘能響應多少次,于是搜索了一些網上的資料,于是編寫了下面的這個程序,雖然這個程序不是我們使用的最終版本,但是也反映了測試的思想,大家略微進行改造,就可以用于類似的測試。    using System;
    using System.Net;
    using System.IO;
    using System.Threading;
    using System.Timers;
    using System.Text.RegularExpressions;
    using System.Collections.Generic;
    using System.Text;
    using System.Runtime.InteropServices;
    using System.ComponentModel;


    namespace TestUrl
    {

        internal class HiPerfTimer
        {
            [DllImport("Kernel32.dll")]
            private static extern bool QueryPerformanceCounter(
                out long lpPerformanceCount);

            [DllImport("Kernel32.dll")]
            private static extern bool QueryPerformanceFrequency(
                out long lpFrequency);

            private long startTime, stopTime;
            private long freq;

            // Constructor
            public HiPerfTimer()
            {
                startTime = 0;
                stopTime = 0;

                if (QueryPerformanceFrequency(out freq) == false)
                {
                    // high-performance counter not supported
                    throw new Win32Exception();
                }
            }

            // Start the timer
            public void Start()
            {
                // lets do the waiting threads there work
                Thread.Sleep(0);

                QueryPerformanceCounter(out startTime);
            }

            // Stop the timer
            public void Stop()
            {
                QueryPerformanceCounter(out stopTime);
            }

            // Returns the duration of the timer (in seconds)
            public double Duration
            {
                get
                {
                    return (double)(stopTime - startTime) / (double)freq;
                }
            }
        }

        class Program
        {

            static long rt = 0;
            static long wr = 0;

            public static int PostData(string url, string data, out string info)
            {

                info = "";
                CookieContainer cc = new CookieContainer();
                HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
            

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>