= !MapGuide RFC 110 - Profiling API enhancement = This page contains a change request (RFC) for the !MapGuide Open Source project. More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. == Status == ||RFC Template Version||(1.0)|| ||Submission Date|| February 23,2011 || ||Last Modified|| Bruce Dechant, February 23,2011 || ||Author|| Bruce Dechant|| ||RFC Status|| draft|| ||Implementation Status||(pending)|| ||Proposed Milestone|| 2.3 || ||Assigned PSC guide(s)||Bruce Dechant|| ||'''Voting History'''|| || ||+1|||| ||+0|||| ||-0|||| ||-1|||| ||no vote|||| == Overview == This RFC adds a !MgProfilingService which provides a skeleton for developers to profile existing !MapGuide APIs. !MgProfilingService aims to help developers and end users to identify resources that need to be optimized and performance bottlenecks. Two Profiling APIs will be implemented in this RFC and developers can add their own Profiling API into !MgProfilingService in the future == Motivation == Profiling APIs that would generate an XML report that could be analyzed to help determine if any resources need to be optimized or if there are performance bottlenecks in the code that need to be looked at. == Proposed Solution == The following NEW APIs will be added to the offical API (PHP, Java and .Net): {{{ MgByteReader* ProfileRenderMap(MgMap* map, MgSelection* selection, MgCoordinate* center, double scale, INT32 width, INT32 height, MgColor* backgroundColor, CREFSTRING format, bool bKeepSelection); }}} {{{ MgByteReader* ProfileRenderDynamicOverlay(MgMap* map, MgSelection* selection, MgRenderingOptions* options); }}} Both of the above APIs will return an XML document that contains the profiling information gathered. (We are not going to implement the Http API for !MgProfilingService) == Information Gathered == The profiling information gathered for !ProfileRenderMap and !ProfileRenderDynamicOverlay: !ProfileRenderMap: {{{ Resource Id Coordinate System Extent Scale Image Format Render Map Time Render Layers Time Render Selection Time Render Watermars Time Render Labels Time Create Image Time }}} !ProfileRenderLayer: {{{ Resource Id Layer Type Coordinate System Current Scale Range Filter Render Time }}} !ProfileRenderWatermark: {{{ Resource Id Position Type Stylization Time }}} !ProfileRenderLabels: {{{ Render Labels Time }}} == XML Report / Schema == The generated XML report document will be defined by the following schema. {{{ }}} Example of profiling rendering map process: {{{ Library://Shaboygan.MapDefinition LL84 43.73,-87.73,43.75,-87.72 10000.00 PNG AGG 8.30 5.00 Library://Buildings.LayerDefinition Vector CA-I ScaleRange1 FeatId > 5 3.00 Library://Districts.LayerDefinition Raster LL84 ScaleRange2 2.00 0.25 FeatId < 100 Library://Trees.LayerDefinition Vector LL84 ScaleRange1 FeatId < 200 0.10 Library://Parcels.LayerDefinition Vector LL84 ScaleRange2 0.15 0.75 Library://Logo.WatermarkDefinition Tile 0.6 Library://Copyright.WatermarkDefinition XY 0.15 1.25 1 }}} == Implications == To profile an existing !MapGuide API, the profiling code will be injected into the original functions being profiled, which means !MgServerServices should be extended to accept a !MgProfileResult and the implementation of some APIs will be updated to support profiling. For example, to support profiling !RenderMap, !MgRenderingServerServices needs to be extented by inheriting from !MgProfileManager which provides set/get method for !MgProfileResult. [[Image(Class Diagram.png)]] == Test Plan == !Build/Run on !Windows/Linux == Funding / Resources == Supplied by Autodesk