2012-02-14 54 views
8

我正在尝试查找我的加载时间正在消耗的位置。我已经加入追踪到几乎所有我能想到的是有缺失的200毫秒(这是总负荷的50%以上)asp.net页面的加载时间无法计入

我如何解释这种缺失的时候

Description      Duration(ms) with Children(ms) from start(ms) 
    http://localhost:80/default.aspx 320.8  357.3    +0.0 
    CreateControlCollection   0.0   0.0    +27.2 
    OnPreInit       0.1   0.1    +27.2 
    GetVaryByCustomString    0.0   0.0    +227.0 
    Control OnInit      0.0   0.0    +232.4 
    Control OnInit      0.0   0.0    +232.4 
    Control OnInit      0.0   0.0    +234.2 
    Control OnInit      0.0   0.0    +234.2 
    Control OnInit      0.0   0.0    +234.2 
    GetVaryByCustomString    0.0   0.0    +234.6 
    Control OnInit      0.0   0.0    +234.9 
    Control OnInit      0.0   0.0    +234.9 
    GetVaryByCustomString    0.0   0.0    +235.0 
    GetVaryByCustomString    0.0   0.0    +235.3 

回答

2

它看起来比如PreInit(一个仅限页面的事件)和Init控件之间正在消耗的未计数时间。一些想法:

  1. 控制初始化是一个可能的罪魁祸首。控制初始化完成后,控制初始化事件被触发,而不是之前。
  2. 您使用的是ASP.NET主题还是皮肤?如果是这样,它们在PreInit和Init之间应用。
  3. 请记住,Init事件是自下而上触发的;孩子在父母面前。
  4. 线程问题是时间间隔的一个可能原因。你是否从一个空闲的系统测量?是否有任何I/O操作在页面生命周期的早期发生?
  5. 您是否使用母版页?如果是这样,请记住,它们是作为页面的子控件实现的。