当前位置: 首页>>代码示例>>C#>>正文


C# ITracer.TraceWarning方法代码示例

本文整理汇总了C#中ITracer.TraceWarning方法的典型用法代码示例。如果您正苦于以下问题:C# ITracer.TraceWarning方法的具体用法?C# ITracer.TraceWarning怎么用?C# ITracer.TraceWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITracer的用法示例。


在下文中一共展示了ITracer.TraceWarning方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StartProfileAsync

        internal static async Task<ProfileResultInfo> StartProfileAsync(int processId, ITracer tracer = null)
        {
            tracer = tracer ?? NullTracer.Instance;
            using (tracer.Step("ProfileManager.StartProfileAsync"))
            {
                // Check if the profiling is already running for the given process. If it does, then just return with 200.
                if (_profilingList.ContainsKey(processId))
                {
                    return new ProfileResultInfo(HttpStatusCode.OK, string.Empty);
                }

                int profilingSessionId = GetNextProfilingSessionId();
                
                string arguments = System.Environment.ExpandEnvironmentVariables(string.Format("start {0} /attach:{1} /loadAgent:4EA90761-2248-496C-B854-3C0399A591A4;DiagnosticsHub.CpuAgent.dll  /scratchLocation:%LOCAL_EXPANDED%\\Temp", profilingSessionId, processId));

                var profileProcessResponse = await ExecuteProfilingCommandAsync(arguments, tracer);

                if (profileProcessResponse.StatusCode != HttpStatusCode.OK)
                {
                    return profileProcessResponse;
                }

                // This may fail if we got 2 requests at the same time to start a profiling session
                // in that case, only 1 will be added and the other one will be stopped.
                if (!_profilingList.TryAdd(processId, new ProfileInfo(profilingSessionId)))
                {
                    tracer.TraceWarning("A profiling session was already running for process {0}, stopping profiling session {1}", processId, profilingSessionId);
                    await StopProfileInternalAsync(processId, profilingSessionId, true, tracer);
                    return new ProfileResultInfo(HttpStatusCode.OK, string.Empty);
                }

                tracer.Step("started session id: {0} for pid: {1}", profilingSessionId, processId);

                EnsureIdleTimer();

                return new ProfileResultInfo(HttpStatusCode.OK, string.Empty);
            }
        }
开发者ID:NorimaConsulting,项目名称:kudu,代码行数:38,代码来源:ProfileManager.cs


注:本文中的ITracer.TraceWarning方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。