本文整理汇总了C#中BrightstarProfiler.GetLogString方法的典型用法代码示例。如果您正苦于以下问题:C# BrightstarProfiler.GetLogString方法的具体用法?C# BrightstarProfiler.GetLogString怎么用?C# BrightstarProfiler.GetLogString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrightstarProfiler
的用法示例。
在下文中一共展示了BrightstarProfiler.GetLogString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSimpleJoinQuery
public void TestSimpleJoinQuery()
{
var sparqlQuery =
@"PREFIX bsbm: <http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/>
SELECT ?review WHERE {
?review bsbm:reviewFor ?product .
?product bsbm:productFeature <http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature2330> .
} LIMIT 3";
// Warm-up
var client = BrightstarService.GetClient("type=embedded;storesDirectory=stores");
for (int i = 0; i < 5; i++)
{
client.ExecuteQuery("SparqlPerformance", sparqlQuery);
}
// Profile
var profiler = new BrightstarProfiler("SimpleJoinQuery");
for (int i = 0; i < 1000; i++)
{
using (profiler.Step("ExecuteQuery"))
{
client.ExecuteQuery("SparqlPerformance", sparqlQuery);
}
}
Console.WriteLine(profiler.GetLogString());
}
示例2: Run
public override void Run()
{
try
{
Logging.LogInfo("Import job being run on file " + _contentFileName);
StoreWorker.TransactionLog.LogStartTransaction(this);
var parser = GetParser(_contentFileName);
var storeDirectory = StoreWorker.WriteStore.DirectoryPath;
var filePath = Path.Combine(storeDirectory,
".." + Path.DirectorySeparatorChar + "import" + Path.DirectorySeparatorChar +
_contentFileName);
var profiler = new BrightstarProfiler("Import " + _contentFileName); // TODO : Conditionally create this if profiling is enabled
Logging.LogDebug("Import file path calculated as '{0}'", filePath);
if (!File.Exists(filePath))
{
ErrorMessage = String.Format("Cannot find file {0} in import directory", _contentFileName);
throw new FileNotFoundException(ErrorMessage);
}
using (_fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
_importTripleSink = new StoreTripleSink(StoreWorker.WriteStore, JobId,
Configuration.TransactionFlushTripleCount,
profiler:profiler);
parser.Parse(_fileStream, this, _graphUri);
}
StoreWorker.WriteStore.Commit(JobId, profiler);
StoreWorker.InvalidateReadStore();
Logging.LogInfo("Import job completed successfully for " + _contentFileName);
if (profiler != null)
{
Logging.LogInfo(profiler.GetLogString());
}
StoreWorker.TransactionLog.LogEndSuccessfulTransaction(this);
}
catch (RdfParserException parserException)
{
ErrorMessage = parserException.Message;
ExceptionDetail = new ExceptionDetail(parserException);
Logging.LogInfo("Parser error processing import job on file " + _contentFileName + ". " + parserException.Message);
throw;
}
catch (Exception ex)
{
ErrorMessage = "Error importing file " + _contentFileName + ". " + ex.Message;
StoreWorker.TransactionLog.LogEndFailedTransaction(this);
Logging.LogInfo("Error processing import job on file " + _contentFileName + ". Error Message: " + ex.Message + " Stack trace: " + ex.StackTrace);
throw;
}
}