2011-06-28 86 views
1

我正在使用MS SQL Server Reporting Services 2008 R2來生成報告。在Reporting Services 2008 R2中使用p4.net

我有Perforce數據庫,我查詢Changesets數據並放入報告。我需要從Perforce數據庫獲取代碼統計信息,但Perforce數據庫沒有這些信息。

因此,我寫了一個自定義DLL以獲取特定變更集中更改的代碼數量。然後我創建了一個計算字段,並調用了計算更改的代碼行數並傳遞變更集編號的方法。

它的工作原理...然而它是愚蠢緩慢......我無法找出爲什麼它很慢,因爲使用p4.net的自定義dll上的代碼計算是從性能點看法。

我知道這是非常具體的情況,但你們可以給我一些想法如何找到導致緩慢的原因嗎?

非常感謝您的幫助,請向我們澄清問題。

乾杯

AnarchistGeek

+1

你有沒有計時你打電話給P4.Net?你正在做什麼樣的呼叫,並且你正在執行多少個呼叫? –

+0

我們需要更多信息,例如,您如何計算價值?命令等?計算何時完成? – Dennis

+0

Mike,謝謝你的回覆。因此,我爲從數據庫中檢索的每條記錄調用一個方法。它大約有7000條記錄。這意味着,Reporting Services會對我的自定義程序集進行7000次方法調用。程序集中的方法將changenumber作爲參數,查找已更改的文件並使用p4 diff2命令計算代碼更改的數量。我找不到更好的方法來更有效地計算它。我不知道我可以如何最小化dll調用的次數..你有想法嗎?謝謝/ – AnarchistGeek

回答

1

你能夠確定的時間大多是在describe命令或diff2命令用在何處?如果使用P4toDb複製元數據,則可以通過讀取關係數據庫中的數據來優化describe部分。

+0

然後調用dll的次數會增加,不會嗎?如果我們從關係數據庫中獲取這些數據,那麼我們需要應用diff的文件數就會增加。我還沒有測試過它,但這是我最初的想法。但如果在差異中找到使用日期和路徑的方法,那麼就會對問題進行排序。那麼至少,我將能夠獲得在特定日期更改的代碼行數,這對我來說已經足夠了。 – AnarchistGeek

+0

只需執行測試即可瞭解哪部分佔用了大部分時間。在8000個變更集中,整個操作花費了14分鐘,並且這個時間的10分鐘被描述方法佔用了將近70%的時間。而30%的文件用於差異化29000個文件。 – AnarchistGeek

0

我有一個建議是預先計算更改大小並將它們存儲在文件修訂版的屬性中。您可以使用未公開的p4 attribute命令。

PS> p4 help undoc 

    attribute -- Set per-revision attributes on revisions (unsupported) 

    p4 attribute [ -e -f -p ] -n name [ -v value ] files... 

     Sets a user-managed attribute 'name' to 'value' on opened files. 
     If -v isn't given the attribute is cleared (if set). 

     Attributes can only be viewed with 'p4 fstat'. 

     The -e flag indicates the 'value' is in hex. 

     The -f flag sets the attribute on submitted files. 

     The -p flag creates an attribute whose value will be propagated 
     when the file is opened with 'p4 add', 'p4 edit', or 'p4 delete'. 

PS> p4 help undoc 

    Unsupported or obsolete Perforce commands and options: 
... 

    p4 fstat [ -Oacedhiz ] [ -A pattern ] 
     The -Oa flag shows attributes set by 'p4 attribute'. The -Oae flag 
     shows the attribute values encoded as hex. The -Od flag outputs the 
     digest of the attribute. The -Oc flag outputs the path, revision and 
     type of the server archive file (requires 'admin' privilege). The 
     -Oz flag outputs the path and revision of any lazy copies (requires 
     'admin' privilege). The -Oh flag outputs the size, digest and any 
     selected attributes of the synced revision rather than the head 
     revision. The -Oi flag outputs extra (debugging) information about 
     the attributes. The -A pattern flag restricts attributes to those 
     matching 'pattern'. 
相關問題