public void VerifyModelsTest() { var performanceInformationFromService = new PerformanceInformation { PerformanceMonitorSecond = 1, RunTimeThreshold = 2, ElapsedTimeTestCase = 3, ExecutionTime = 4, PerformanceMonitor = "PM", Ram = "ram", Cpu = "cpu" }; var performanceInformation = new PerformanceInformation { PerformanceMonitorSecond = 1, RunTimeThreshold = 2, ElapsedTimeTestCase = 3, ExecutionTime = 4, PerformanceMonitor = "PM", Ram = "ram", Cpu = "cpu" }; Verify.Models.AreEqual(performanceInformationFromService, performanceInformation, "Verify Models"); }
public MemInfo() { TotalMemory = -1; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { PerformanceInformation pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { TotalMemory = Convert.ToInt64((pi.PhysicalTotal.ToInt64() * pi.PageSize.ToInt64() / 1024 / 1024)); } } else { string[] lines = File.ReadAllLines("/proc/meminfo"); foreach (string line in lines) { if (line.StartsWith("MemTotal")) { TotalMemory = Convert.ToInt64(line.Split(':')[1].Replace("kB", "").Trim()) / 1024; break; } } } }
//Todo: Remove the mock code once Visa provides the saveoffer api /// <summary> /// Visa is supposed to implemented an api for register deal /// it is not available now and all deals are registered manually offline /// We are mocking the request now /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <RegisterDealResponse> RegisterDeal(RegisterDealRequest request) { #if !XXXDEBUG string logstring = string.Format("{0} RegisterDealRequest {1}\n", DateTime.Now.ToString(CultureInfo.InvariantCulture), request.BingOfferDealId); // just the last four digits File.AppendAllText(Logfilename, logstring); #endif RegisterDealResponse response; Stopwatch sprocTimer = Stopwatch.StartNew(); try { response = await RegisterDealMock.RegisterDeal(request).ConfigureAwait(false); } finally { sprocTimer.Stop(); PerformanceInformation.Add("Visa RegisterDeal ", String.Format("{0} ms", sprocTimer.ElapsedMilliseconds)); } #if !XXXDEBUG logstring = string.Format("{0} RegisterDealResponse {1}, {2}\n", DateTime.Now.ToString(CultureInfo.InvariantCulture), request.BingOfferDealId, response.VisaDealId); // just the last four digits File.AppendAllText(Logfilename, logstring); #endif return(response); }
public static long GetTotalMemoryInMiB() { var pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) return Convert.ToInt64(pi.PhysicalTotal.ToInt64()*pi.PageSize.ToInt64()/1048576); return -1; }
public static string GetAvailableMemory() { var info = new PerformanceInformation(); info.cb = Marshal.SizeOf <PerformanceInformation>(); GetPerformanceInfo(ref info, Marshal.SizeOf <PerformanceInformation>()); return($"{info.PhysicalAvailable.ToInt64() >> 8} MB"); }
public static string GetCommits() { var info = new PerformanceInformation(); info.cb = Marshal.SizeOf <PerformanceInformation>(); GetPerformanceInfo(ref info, Marshal.SizeOf <PerformanceInformation>()); return($"{info.CommitTotal.ToInt64() >> 8} MB / {info.CommitLimit.ToInt64() >> 8} MB"); }
public static uint GetNumberHandles() { var info = new PerformanceInformation(); info.cb = Marshal.SizeOf <PerformanceInformation>(); GetPerformanceInfo(ref info, Marshal.SizeOf <PerformanceInformation>()); return(info.HandleCount); }
public static Int64 GetPhysicalAvailableMemoryInMiB() { PerformanceInformation pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return Convert.ToInt64((pi.PhysicalAvailable.ToInt64() * pi.PageSize.ToInt64() / 1048576)); } return -1; }
#pragma warning restore 1591 /// <summary> /// Returns the amount of free RAM on the machine in MB /// </summary> public static long GetAvailablePhysicalMemoryInMB() { PerformanceInformation pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return(Convert.ToInt64((pi.PhysicalAvailable.ToInt64() * pi.PageSize.ToInt64() / 1048576))); } return(-1); }
public static long GetPhysicalAvailableMemoryInMiB() { var pi = new PerformanceInformation(); if (GetPerformanceInfo()) { return(Convert.ToInt64(pi.PhysicalAvailable.ToInt64() * pi.PageSize.ToInt64() / 1048576)); } return(-1); }
public static uint GetNumberThreads() { var info = new PerformanceInformation { cb = Marshal.SizeOf <PerformanceInformation>() }; GetPerformanceInfo(ref info, Marshal.SizeOf <PerformanceInformation>()); return(info.ThreadCount); }
public static string GetTotalMemory() { var info = new PerformanceInformation { cb = Marshal.SizeOf <PerformanceInformation>() }; GetPerformanceInfo(ref info, Marshal.SizeOf <PerformanceInformation>()); return($"{info.PhysicalTotal.ToInt64() >> 8} MB"); }
public static long GetTotalMemoryInMiB() { var pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return(Convert.ToInt64(pi.PhysicalTotal.ToInt64() * pi.PageSize.ToInt64() / 1048576)); } return(-1); }
public static long GetPhysicalAvailableMemoryInMiB() { var information = new PerformanceInformation(); if (GetPerformanceInfo(out information, Marshal.SizeOf(information))) { return(Convert.ToInt64(information.PhysicalAvailable.ToInt64() * information.PageSize.ToInt64() / 1048576)); } return(-1); }
public PhysMemHistoryIcon() { this.UseSecondLine = false; this.UseLongData = true; PerformanceInformation info = new PerformanceInformation(); info.Size = Marshal.SizeOf(info); Win32.GetPerformanceInfo(out info, info.Size); this.MinMaxValue = info.PhysicalTotal.ToInt64(); }
public static Int64 GetTotalMemory() { var performanceInformation = new PerformanceInformation(); if (GetPerformanceInfo(out performanceInformation, Marshal.SizeOf(performanceInformation))) { return(performanceInformation.PhysicalTotal.ToInt64() * performanceInformation.PageSize.ToInt64()); } return(-1); }
public static Int64 GetTotalMemory() { var performanceInformation = new PerformanceInformation(); if (GetPerformanceInfo(out performanceInformation, Marshal.SizeOf(performanceInformation))) { return performanceInformation.PhysicalTotal.ToInt64()*performanceInformation.PageSize.ToInt64(); } return -1; }
public static Int64 GetTotalMemoryInMb() { PerformanceInformation pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return Convert.ToInt64((pi.PhysicalTotal.ToInt64() * pi.PageSize.ToInt64() / 1048576)); } else { return -1; } }
/// <summary> /// Adds Load Information to Node /// </summary> /// <param name="loadInformation">See <see cref="Model.PerformanceInformation"/></param> void INode.AddPerformance(PerformanceInformation loadInformation) { this.PerformanceInformation.ForEach((item) => { if (item.RecordedOn < DateTime.UtcNow.AddDays(-7)) { this.PerformanceInformation.Remove(item); } }); this.PerformanceInformation.Add(loadInformation); }
public static void GetNumProcessAndThreads(out int numProcs, out int numThreads) { numProcs = 0; numThreads = 0; PerformanceInformation pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { numProcs = pi.ProcessCount; numThreads = pi.ThreadCount; } }
private static Int64 GetTotalMemoryInMiB() { PerformanceInformation pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return(Convert.ToInt64((pi.PhysicalTotal.ToInt64() * pi.PageSize.ToInt64() / 1048576))); } else { return(-1); } }
public static long GetTotalMemoryInMB() { var pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return(pi.PhysicalTotal.ToInt64() * pi.PageSize.ToInt64() / 1_048_576L); } else { return(-1); } }
public static Int64 GetRAMAvailable() { PerformanceInformation pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return(Convert.ToInt64((pi.PhysicalAvailable.ToInt64() * pi.PageSize.ToInt64() / 1048576))); } else { return(-1); } }
public static Int64 GetTotalMemory() { PerformanceInformation performanceInfoClass = new PerformanceInformation(); if (GetPerformanceInfo(out performanceInfoClass, Marshal.SizeOf(performanceInfoClass))) { return(Convert.ToInt64(performanceInfoClass.PhysicalTotal.ToInt64() * performanceInfoClass.PageSize.ToInt64() / 1048576)); } else { return(-1); } }
public static int GetPhysicalAvailableMemoryInMiB() { PerformanceInformation pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return(Convert.ToInt32((pi.PhysicalAvailable.ToInt32() * pi.PageSize.ToInt32() / 1048576))); } else { return(-1); } }
// Get the amount of computer RAM. public static long GetTotalMemory() { PerformanceInformation pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return(Convert.ToInt64(pi.PhysicalTotal.ToInt64() * pi.PageSize.ToInt64())); } else { return(-1); } }
public static long GetTotalMemoryInMiB() { PerformanceInformation performanceInformation = new PerformanceInformation(); if (GetPerformanceInfo(out performanceInformation, Marshal.SizeOf(performanceInformation))) { return(Convert.ToInt64((performanceInformation.PhysicalTotal.ToInt64() * performanceInformation.PageSize.ToInt64() / 1048576))); } else { return(-1); } }
public static int GetTotalThreadCount() { PerformanceInformation pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return(pi.ThreadCount); } else { return(-1); } }
// Gathering the Total Amount of Memory on the Host in Megabtyes. public static Int64 GetTotalMemoryInMiB() { PerformanceInformation pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return Convert.ToInt64((pi.PhysicalTotal.ToInt64() * pi.PageSize.ToInt64() / 1048576)); } else { Console.WriteLine("There was a problem retrieving the Total Amount of Memory on the Host."); return 2; } }
/// <summary> /// Creates a new instance for the Commerce Context class. /// You can specify the config to use. /// </summary> /// <param name="apiCallDescription"> /// The call description for the API in which this context object is used. /// </param> /// <param name="config"> /// The config to use to get configuration info from. /// </param> public CommerceContext(string apiCallDescription, CommerceConfig config) { ApiCallDescription = apiCallDescription; Config = config; if (config != null) { Log = new CommerceLog(Guid.NewGuid(), config.LogVerbosity, General.CommerceLogSource); CommerceLog.Config = config; } PerformanceInformation = new PerformanceInformation(); Values = new Hashtable(); }
private PerformanceInformation ParsePerformanceResponseHeader(HttpResponseMessage response) { var perfInfo = new PerformanceInformation(); if (response.Headers.TryGetValues("x-ms-maa-perf-info", out var values)) { var iterator = values.GetEnumerator(); iterator.MoveNext(); perfInfo = PerformanceInformation.CreateFromHeaderString(iterator.Current); } return(perfInfo); }
public static Int64 GetTotalMemoryInMiB() { PerformanceInformation pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, System.Runtime.InteropServices.Marshal.SizeOf(pi))) { return(Convert.ToInt64((pi.PhysicalTotal.ToInt64() * pi.PageSize.ToInt64() / 1048576))); } else { return(-1); } }
public static long GetKernelNonPagedInMiB() { PerformanceInformation performanceInformation = new PerformanceInformation(); if (GetPerformanceInfo(out performanceInformation, Marshal.SizeOf(performanceInformation))) { return(Convert.ToInt64((performanceInformation.KernelNonPaged.ToInt64() * performanceInformation.PageSize.ToInt64() / 1048576))); } else { return(-1); } }
public static uint GetTotalMemoryInKiB() { var pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return(Convert.ToUInt32((pi.PhysicalTotal.ToInt64() * pi.PageSize.ToInt64() / 1024))); } else { return(0); } }
/// <summary> /// Remove a user request /// </summary> /// <param name="request">request for remove user</param> /// <param name="shallNotRun">Shall not run for normal cases</param> /// <returns>response for removing user</returns> public async Task <Unenroll_Response> RemoveUser(UnenrollRequest request, bool shallNotRun = true) { Unenroll_Response response; using (var client = VisaRtmClientManager.Instance.GetVisaRtmClient()) { Stopwatch sprocTimer = Stopwatch.StartNew(); try { if (shallNotRun) { response = new Unenroll_Response(); response.Success = true; } else { #if !XXXDEBUG string logstring = string.Format("{0} UnenrollRequest {1}\n", DateTime.Now.ToString(CultureInfo.InvariantCulture), ((ExternalAuthenticationRecord)request.AuthenticationRecord) .UserKey); // just the last four digits File.AppendAllText(Logfilename, logstring); #endif response = await client.UnenrollAsync(request).ConfigureAwait(false); #if !XXXDEBUG if (response.Success) { logstring = string.Format("{0} UnenrollResponse {1} {2}\n", DateTime.Now.ToString(CultureInfo.InvariantCulture), ((ExternalAuthenticationRecord)request.AuthenticationRecord) .UserKey, response.Success); File.AppendAllText(Logfilename, logstring); } #endif } } finally { sprocTimer.Stop(); if (PerformanceInformation != null) { PerformanceInformation.Add("Visa RemoveUser ", String.Format("{0} ms", sprocTimer.ElapsedMilliseconds)); } } } return(response); }
public static Int64 GetTotalMemory() { try { var pi = new PerformanceInformation(); if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return Convert.ToInt64((pi.PhysicalTotal.ToInt64()*pi.PageSize.ToInt64())); } } catch (Exception ex) { DebugHelper.Exception(ex); } return -1; }