2013-05-15 90 views
0

我在Coldfusion 9上運行一個cfwheels應用程序,我需要獲取cfhweels的本地調試變量以將它們存儲在數據庫表中。CFWheels'request.wheels.execution'結構轉儲問題

我想要得到#request.wheels.execution#它返回一個結構與控制器,行動,請求的運行時間。當我轉儲結構時,我獲得了幾百萬毫秒的運行時間,並且屏幕底部的完全相同的代碼顯示了幾百毫秒,這是正確的時間。

任何人都知道如何將這些數字轉換爲調試部分顯示的數字?

這是我從cfwheels中直接得到的代碼,它在屏幕底部輸出運行時間,但是當我隔離代碼時,數字會再次混亂。

<cfif request.wheels.execution.total GT 0> 
    (<cfset loc.keys = StructSort(request.wheels.execution, "numeric", "desc")> 
    <cfset loc.firstDone = false> 

     <cfloop from="1" to="#arrayLen(loc.keys)#" index="loc.i"> 
      <cfset loc.key = loc.keys[loc.i]> 
      <cfif loc.key IS NOT "total" AND request.wheels.execution[loc.key] GT 0> 
       <cfif loc.firstDone> 
        , 
       </cfif> 
        #LCase(loc.key)# ~#request.wheels.execution[loc.key]#ms<cfset loc.firstDone = true> 
      </cfif> 
     </cfloop>) 
    </cfif> 

回答

0

你在調試輸出看到的值,因爲它要求在不同時間調用getTickCount()在由框架記錄毫秒的差異。

您可以通過在設計模式重裝並添加以下內容到版式視圖頂部演示這一點:

<cfset ticks = getTickCount() /> 

然後,在視圖中的最後一行,補充一點:

<cfoutput> 
this view took #getTickCount()-ticks# milliseconds to process. 
</cfoutput>