|
pagetest分析web 页面解析时间。PageTest为AOL 开放源码的,
可从http://pagetest.wiki.sourceforge.net/ 下载。
作用同ibm pagedetailer ,yahoo yslow。
pagetest用visual .net工程。
核心技术
1 Winsock2 SPI
参考
http://www.microsoft.com/msj/059 ... LayeredService.aspx
http://www.vckbase.com/document/viewdoc/?id=643
或者windows 网络编程第14章winsock2服务提供者接口
如加载 SPI
wspStartup = new CAPIHook("mswsock.dll", "WSPStartup", (PROC)::WSPStartup_Hook, TRUE);
nspStartup = new CAPIHook("mswsock.dll", "NSPStartup", (PROC)::NSPStartup_Hook, TRUE);
主要函数如:
NSPLookupServiceBegin;NSPLookupServiceNext;NSPLookupServiceEnd
WSPSocket,WSPBind
2 WinInet
如
internetOpen
3 IE插件技术
class ATL_NO_VTABLE CIEHook :
public IObjectWithSiteImpl<CIEHook>,
public IOleCommandTarget,
public IDispEventImpl<1, CIEHook, &DIID_DWebBrowserEvents2, &LIBID_SHDocVw, 1, 1>,
public IIEHook
STDMETHOD_(void,OnBeforeNavigate2)( IDispatch *pDisp, VARIANT * url, VARIANT * Flags, VARIANT * TargetFrameName, VARIANT * PostData, VARIANT * Headers, VARIANT_BOOL * Cancel );
STDMETHOD_(void,OnDocumentComplete)( IDispatch *pDisp, VARIANT * url );
STDMETHOD_(void,OnDownloadBegin)( VOID );
STDMETHOD_(void,OnDownloadComplete)( VOID );
STDMETHOD_(void,OnNavigateComplete)( IDispatch *pDisp, VARIANT * url );
STDMETHOD_(void,OnNavigateError)( IDispatch *pDisp, VARIANT *url, VARIANT *TargetFrameName, VARIANT *StatusCode, VARIANT_BOOL *Cancel);
STDMETHOD_(void,OnNewWindow)( IDispatch ** pDisp, VARIANT_BOOL *cancel );
STDMETHOD_(void,OnQuit)( VOID );
// IOleObjectWithSite Methods
STDMETHOD(SetSite)(IUnknown *pUnkSite);
然后在IE浏览器初始化时做
void CIEHook::InstallHooks(void)
{
// load ourselves to make sure we stay loaded until the browser goes away
// otherwise some of the API hooks will crash
LoadLibrary(_T("agetest.dll"));
// hook the browser wndProc (to supress crashes)
#ifndef DEBUG
if( !dispatch_hook )
dispatch_hook = new CAPIHook("user32.dll", "DispatchMessageW", (PROC):ispatchMessageW_hook, TRUE);
#endif
// hook winsock
WinsockInstallHooks();
// hook wininet
WinInetInstallHooks();
}
4 windows精确计时
EnterCriticalSection(&cs);
QueryPerformanceCounter((LARGE_INTEGER *)&lastActivity);
LeaveCriticalSection(&cs);
5 各个环节的衔接
这个才是重中之重。 |
|