Exemplo n.º 1
0
 static void ProcessModeForStatic(HttpApplication app, ProfilerContext context)
 {
     serviceData.BufferDatas.Enqueue(context.Data);
     while (serviceData.BufferDatas.Count > serviceData.Setting.StaticCount)
     {
         ProfilerData pd;
         serviceData.BufferDatas.TryDequeue(out pd);
     }
 }
Exemplo n.º 2
0
        static void ProcessModeForRequest(HttpApplication app, ProfilerContext context)
        {
            if (app.Response.StatusCode == (int)HttpStatusCode.OK)
            {
                string json = serializer.Serialize(context.Data);

                if (app.Response.ContentType.Contains("application/json"))
                {
                    app.Response.Write("\r" + ProfilerBegin + json + ProfilerEnd);
                }
                else if (app.Response.ContentType.Contains("text/html"))
                {
                    app.Response.Write("<script type=\"text/javascript\">if(typeof($profiler) != 'undefined'){$profiler.add(" + json + ");}</script>");
                }
            }
        }
Exemplo n.º 3
0
        static void PushRequest(ProfilerContext context)
        {
            if (!serviceData.Setting.RequestEnabled)
            {
                return;
            }

            RequestData rd = new RequestData()
            {
                Time       = NetworkTime.Now,
                Url        = context.Data.Request.Url,
                HttpMethod = context.Data.Request.Method,
                Header     = context.Data.Request.Header,
                Body       = context.Data.Request.Body
            };

            serviceData.RequestDatas.Enqueue(rd);
            while (serviceData.RequestDatas.Count > serviceData.Setting.RequestCount)
            {
                RequestData ord;
                serviceData.RequestDatas.TryDequeue(out ord);
            }
        }
 void IDisposable.Dispose()
 {
     ProfilerContext.EndWatch();
 }
 public WatchScope(string message)
 {
     ProfilerContext.BeginWatch(message);
 }