本文整理汇总了C#中FunctionId类的典型用法代码示例。如果您正苦于以下问题:C# FunctionId类的具体用法?C# FunctionId怎么用?C# FunctionId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FunctionId类属于命名空间,在下文中一共展示了FunctionId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LogBlockEnd
public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int blockId, int delta, CancellationToken cancellationToken)
{
var kvLogMessage = logMessage as KeyValueLogMessage;
if (kvLogMessage == null)
{
return;
}
try
{
// guard us from exception thrown by telemetry
var telemetryEvent = CreateTelemetryEvent(functionId, End);
SetBlockId(telemetryEvent, functionId, blockId);
var durationName = functionId.GetPropertyName(Duration);
telemetryEvent.SetIntProperty(durationName, delta);
var cancellationName = functionId.GetPropertyName(CancellationRequested);
telemetryEvent.SetBoolProperty(cancellationName, cancellationToken.IsCancellationRequested);
_session.PostEvent(telemetryEvent);
}
catch
{
}
}
示例2: AggregateNode
internal AggregateNode(DataTable table, FunctionId aggregateType, string columnName, bool local, string relationName) : base(table) {
Debug.Assert(columnName != null, "Invalid parameter column name (null).");
this.aggregate = (Aggregate)(int)aggregateType;
if (aggregateType == FunctionId.Sum)
this.type = AggregateType.Sum;
else if (aggregateType == FunctionId.Avg)
this.type = AggregateType.Mean;
else if (aggregateType == FunctionId.Min)
this.type = AggregateType.Min;
else if (aggregateType == FunctionId.Max)
this.type = AggregateType.Max;
else if (aggregateType == FunctionId.Count)
this.type = AggregateType.Count;
else if (aggregateType == FunctionId.Var)
this.type = AggregateType.Var;
else if (aggregateType == FunctionId.StDev)
this.type = AggregateType.StDev;
else {
throw ExprException.UndefinedFunction(Function.FunctionName[(Int32)aggregateType]);
}
this.local = local;
this.relationName = relationName;
this.columnName = columnName;
}
示例3: CreateOption
private static Option<bool> CreateOption(FunctionId id)
{
var name = Enum.GetName(typeof(FunctionId), id);
return new Option<bool>(nameof(FunctionIdOptions), name, defaultValue: false,
storageLocations: new LocalUserProfileStorageLocation(@"Roslyn\Internal\Performance\FunctionId\" + name));
}
示例4: Function
internal Function()
{
this.parameters = new Type[3];
this.name = null;
this.id = FunctionId.none;
this.result = null;
this.IsValidateArguments = false;
this.argumentCount = 0;
}
示例5: Construct
public void Construct(FunctionId functionId, string message, int blockId, CancellationToken cancellationToken)
{
this.functionId = functionId;
this.tick = Environment.TickCount;
this.blockId = blockId;
this.cancellationToken = cancellationToken;
RoslynEventSource.Instance.BlockStart(message, functionId, blockId);
}
示例6: LogBlockEnd
public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int uniquePairId, int delta, CancellationToken cancellationToken)
{
if (!_pendingActivities.TryRemove(uniquePairId, out var activity))
{
Contract.Requires(false, "when can this happen?");
return;
}
activity.Dispose();
}
示例7: TraceLogBlock
public TraceLogBlock(FeatureId featureId, FunctionId functionId, string message, int uniquePairId, CancellationToken cancellationToken)
{
this.featureId = featureId;
this.functionId = functionId;
this.uniquePairId = uniquePairId;
this.cancellationToken = cancellationToken;
this.watch = Stopwatch.StartNew();
Trace.WriteLine(string.Format("[{0}] Start({1}) : {2}/{3} - {4}", Thread.CurrentThread.ManagedThreadId, uniquePairId, featureId.ToString(), functionId.ToString(), message));
}
示例8: Construct
public void Construct(ILogger logger, FunctionId functionId, LogMessage logMessage, int blockId, CancellationToken cancellationToken)
{
this.logger = logger;
this.functionId = functionId;
this.logMessage = logMessage;
this.tick = Environment.TickCount;
this.blockId = blockId;
this.cancellationToken = cancellationToken;
logger.LogBlockStart(functionId, logMessage, blockId, cancellationToken);
}
示例9: GetDefaultValue
private static bool GetDefaultValue(FunctionId id)
{
switch (id)
{
// change not to enable any etw events by default.
// we used to couple this to other logger such as code marker but now it is only specific to etw.
// each events should be enabled specifically when needed.
default:
return false;
}
}
示例10: LogBlockEnd
public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int uniquePairId, int delta, CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
RoslynEventSource.Instance.BlockCanceled(functionId, delta, uniquePairId);
}
else
{
RoslynEventSource.Instance.BlockStop(functionId, delta, uniquePairId);
}
}
示例11: LogBlockStart
public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int blockId, CancellationToken cancellationToken)
{
var kvLogMessage = logMessage as KeyValueLogMessage;
if (kvLogMessage == null)
{
return;
}
try
{
// guard us from exception thrown by telemetry
var telemetryEvent = CreateTelemetryEvent(functionId, Start, kvLogMessage);
SetBlockId(telemetryEvent, functionId, blockId);
_session.PostEvent(telemetryEvent);
}
catch
{
}
}
示例12: Log
public void Log(FunctionId functionId, LogMessage logMessage)
{
var kvLogMessage = logMessage as KeyValueLogMessage;
if (kvLogMessage == null)
{
return;
}
try
{
// guard us from exception thrown by telemetry
if (!kvLogMessage.ContainsProperty)
{
_session.PostSimpleEvent(functionId.GetEventName());
return;
}
var telemetryEvent = CreateTelemetryEvent(functionId, logMessage: kvLogMessage);
_session.PostEvent(telemetryEvent);
}
catch
{
}
}
示例13: LogBlockEnd
public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int uniquePairId, int delta, CancellationToken cancellationToken)
{
_model.BlockDisposed(functionId);
}
示例14: GetOption
public static Option<bool> GetOption(FunctionId id)
{
return s_options.GetOrAdd(id, s_optionCreator);
}
示例15: BlockCanceled
public void BlockCanceled(FunctionId functionId, int tick, int blockId)
{
WriteEvent(5, (int)functionId, tick, blockId);
}