コード例 #1
0
 public static extern Result GetEventProfilingInformation(
     [In] IntPtr eventHandle,
     [In][MarshalAs(UnmanagedType.U4)] ProfilingInformation parameterName,
     [In] UIntPtr parameterValueSize,
     [Out] byte[] parameterValue,
     [Out] out UIntPtr parameterValueSizeReturned
     );
コード例 #2
0
 ///<summary>
 /// Create a new instance
 ///</summary>
 public EmbeddedDatabaseCommands(DocumentDatabase database, DocumentConvention convention, Guid?sessionId)
 {
     profilingInformation = ProfilingInformation.CreateProfilingInformation(sessionId);
     this.database        = database;
     this.convention      = convention;
     OperationsHeaders    = new NameValueCollection();
 }
コード例 #3
0
ファイル: EnableProfiling.cs プロジェクト: stjordanis/docs-1
        public EnableProfiling()
        {
            using (var documentStore = new DocumentStore())
            {
                #region initialize_profiling
                documentStore.InitializeProfiling();
                #endregion

                Guid id = Guid.Empty;

                #region get_profiling_info
                ProfilingInformation profilingInformation = documentStore.GetProfilingInformationFor(id);
                #endregion

                #region example
                Guid sesionId;
                using (IDocumentSession session = documentStore.OpenSession())
                {
                    sesionId = ((DocumentSession)session).Id;

                    session.Load <Employee>("employees/1");
                }

                ProfilingInformation sessionProfilingInfo = documentStore.GetProfilingInformationFor(sesionId);
                #endregion
            }
        }
コード例 #4
0
        public override void GetData(object target, System.IO.Stream outgoingData)
        {
            var session = (DocumentSession)target;
            var profilingInformation = ((DocumentStore)session.DocumentStore).GetProfilingInformationFor(session.Id) ??
                                       ProfilingInformation.CreateProfilingInformation(session.Id);

            new BinaryFormatter().Serialize(outgoingData, profilingInformation);
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AsyncServerClient"/> class.
 /// </summary>
 public AsyncServerClient(string url, DocumentConvention convention, ICredentials credentials, HttpJsonRequestFactory jsonRequestFactory, Guid?sessionId)
 {
     profilingInformation    = ProfilingInformation.CreateProfilingInformation(sessionId);
     this.url                = url.EndsWith("/") ? url.Substring(0, url.Length - 1) : url;
     this.convention         = convention;
     this.credentials        = credentials;
     this.jsonRequestFactory = jsonRequestFactory;
     this.sessionId          = sessionId;
 }
コード例 #6
0
        public ProfilingInformation Filter(ProfilingInformation information)
        {
            var profilingInformation = ProfilingInformation.CreateProfilingInformation(information.Id);

            profilingInformation.At      = information.At;
            profilingInformation.Context = information.Context;
            profilingInformation.DurationMilliseconds = information.DurationMilliseconds;
            profilingInformation.Requests             = information.Requests.Select(FilterRequest).ToList();
            return(profilingInformation);
        }
コード例 #7
0
 ///<summary>
 /// Create a new instance
 ///</summary>
 public EmbeddedDatabaseCommands(DocumentDatabase database, DocumentConvention convention, Guid?sessionId)
 {
     profilingInformation = ProfilingInformation.CreateProfilingInformation(sessionId);
     this.database        = database;
     this.convention      = convention;
     OperationsHeaders    = new NameValueCollection();
     if (database.Configuration.IsSystemDatabase() == false)
     {
         throw new InvalidOperationException("Database must be a system database");
     }
 }
コード例 #8
0
        /// <summary>
        /// Initializes the class
        /// </summary>
        /// <param name="logTarget">The target action to be called at end of profiling</param>
        /// <param name="tag">A user defined tag that uniquely identifies a block being profiled</param>
        /// <param name="silent">Set this to true to ensure that the profiling results are not report.</param>
        /// <param name="lineNumber">Compiler supplied line number. Do not provide this value yourself</param>
        /// <param name="filename">Compiler supplied filename. Do not provide this value yourself</param>
        public ProfilerService(Expression <Action <ProfilingInformation> > logTarget, string tag, bool silent, [CallerLineNumber] int lineNumber = 0, [CallerFilePath] string filename = "")
        {
            _profilingInfo = new ProfilingInformation
            {
                Tag        = tag,
                Silent     = silent,
                Filename   = filename,
                LineNumber = lineNumber
            };

            _logTarget = logTarget;
            _stopWatch = new Stopwatch();
            _stopWatch.Start();
        }
コード例 #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AsyncServerClient"/> class.
        /// </summary>
        public AsyncServerClient(string url, DocumentConvention convention, ICredentials credentials, HttpJsonRequestFactory jsonRequestFactory, Guid?sessionId, Task veryFirstRequest)
        {
            profilingInformation    = ProfilingInformation.CreateProfilingInformation(sessionId);
            this.url                = url.EndsWith("/") ? url.Substring(0, url.Length - 1) : url;
            this.convention         = convention;
            this.credentials        = credentials;
            this.jsonRequestFactory = jsonRequestFactory;
            this.sessionId          = sessionId;
            this.veryFirstRequest   = veryFirstRequest;

            jsonRequestFactory.ConfigureRequest += (sender, args) =>
            {
                args.JsonRequest.WaitForTask = veryFirstRequest;
            };
        }
コード例 #10
0
ファイル: AsyncServerClient.cs プロジェクト: larsw/ravendb
        /// <summary>
        /// Initializes a new instance of the <see cref="AsyncServerClient"/> class.
        /// </summary>
        public AsyncServerClient(string url, DocumentConvention convention, ICredentials credentials, HttpJsonRequestFactory jsonRequestFactory, Guid?sessionId)
        {
            profilingInformation    = ProfilingInformation.CreateProfilingInformation(sessionId);
            this.url                = url.EndsWith("/") ? url.Substring(0, url.Length - 1) : url;
            this.convention         = convention;
            this.credentials        = credentials;
            this.jsonRequestFactory = jsonRequestFactory;
            this.sessionId          = sessionId;

            // required to ensure just a single auth dialog
            Task task = jsonRequestFactory.CreateHttpJsonRequest(this, (url + "/docs?pageSize=0").NoCache(), "GET", credentials, convention)
                        .ReadResponseStringAsync();

            jsonRequestFactory.ConfigureRequest += (sender, args) =>
            {
                args.JsonRequest.WaitForTask = task;
            };
        }
コード例 #11
0
ファイル: RavenProfiler.cs プロジェクト: tal952/ravendb
        private static void ProfilingInformationOnOnContextCreated(ProfilingInformation profilingInformation)
        {
            if (RecordCurrentControllerContextFilter.CurrentControllerContext == null)
            {
                return;
            }

            var routeData = RecordCurrentControllerContextFilter.CurrentControllerContext.RequestContext.RouteData;

            if (routeData == null)
            {
                return;
            }
            foreach (var value in routeData.Values)
            {
                profilingInformation.Context[value.Key] = (value.Value ?? "null").ToString();
            }
        }