我们需要在windows azure web角色中启用25个以上的性能计数器.我正在考虑RDP,并逐一启用它们.但这可能需要很长时间,如果我们扩大规模也不会保证.
有人可以帮助我是否可以自动化这个过程?最好是Powershell,但其他解决方案也可以.
当我开始我的游戏时,它保持在 95-101 左右快速变化,在所有这些数字之间..但是当我打开统计栏时,我得到了 200 的低 300
所以想知道为什么这对 c# 来说仍然是新的,所以对我来说很容易哈哈。继承人的代码像往常一样提前致谢^_^。
float deltaTime = 0.0f;
void Update()
{
deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
}
void OnGUI()
{
int w = Screen.width, h = Screen.height;
GUIStyle style = new GUIStyle ();
Rect rect = new Rect (0, 0, w, h * 2 / 100);
style.alignment = TextAnchor.UpperRight;
style.fontSize = h * 2 / 100;
style.normal.textColor = new Color (255.0f, 255.0f, 255.0f, 1.0f);
float msec = deltaTime * 1000.0f;
float fps = …Run Code Online (Sandbox Code Playgroud) 我使用以下perf命令对用户空间对 DRAM 的读取访问进行采样evince:
perf record -d --call-graph dwarf -c 100 -e mem_load_uops_retired.l3_miss:uppp /opt/evince-3.28.4/bin/evince
Run Code Online (Sandbox Code Playgroud)
可以看出,我使用该PEBS功能来提高采样的准确性。但是有一些非内存访问报告为内存访问。例如,这是一个由 报告的采样事件perf script:
evince 20589 16079.401401: 100 mem_load_uops_retired.l3_miss:uppp: 555555860750 5080022 N/A|SNP N/A|TLB N/A|LCK N/A
555555579939 ev_history_can_go_back+0x19 (/opt/evince-3.28.4/bin/evince)
5555555862ef ev_window_update_actions_sensitivity+0xa1f (/opt/evince-3.28.4/bin/evince)
55555558ce4f ev_window_page_changed_cb+0xf (/opt/evince-3.28.4/bin/evince)
7ffff574510c g_closure_invoke+0x19c (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.4)
7ffff575805d signal_emit_unlocked_R+0xf4d (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.4)
7ffff5760714 g_signal_emit_valist+0xa74 (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.4)
7ffff576112e g_signal_emit+0x8e (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.4)
7ffff7140d76 emit_value_changed+0xf6 (inlined)
7ffff7140d76 adjustment_set_value+0xf6 (inlined)
7ffff7140d76 gtk_adjustment_set_value_internal+0xf6 (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0.2200.30)
7ffff574510c g_closure_invoke+0x19c (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.4)
7ffff5757de7 signal_emit_unlocked_R+0xcd7 (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.4)
7ffff575fc7f g_signal_emitv+0x27f (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.4)
7ffff7153519 gtk_binding_entry_activate+0x289 (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0.2200.30)
7ffff71539ef binding_activate+0x5f (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0.2200.30) …Run Code Online (Sandbox Code Playgroud) 我正在使用的处理器架构有一个时间标签计数器,我想读出来进行性能测量.时间标记计数器的内存映射到地址0x90000008.我使用以下例程从时间计数器读取值,但打印输出的差异始终为零.谁知道我错过了什么?
char* const ADDR = (char *) 0x90000008;
unsigned long cycle_count_val() {
unsigned long res;
asm volatile (
"set ADDR, %%l0 \n\t"
"ld [%%l0], %0 \n\t"
: "=r" (res)
:
: "%l0"
);
return res;
}
....
unsigned long start = cycle_count_val();
execute_benchmark();
unsigned long end = cycle_count_val();
printf("Benchmark performance(in clock cycles) = %ld \r\n", end-start);
Run Code Online (Sandbox Code Playgroud)
非常感谢你的帮助,菲尔
这是代码:
private static void CreateCounter()
{
if (PerformanceCounterCategory.Exists("DemoCategory"))
PerformanceCounterCategory.Delete("DemoCategory");
CounterCreationDataCollection ccdArray = new CounterCreationDataCollection();
CounterCreationData ccd = new CounterCreationData();
ccd.CounterName = "RequestsPerSecond";
ccd.CounterType = PerformanceCounterType.NumberOfItems32;
ccd.CounterHelp = "Requests per second";
ccdArray.Add(ccd);
PerformanceCounterCategory.Create("DemoCategory", "Demo category",
PerformanceCounterCategoryType.SingleInstance, ccdArray);
Console.WriteLine("Press any key, to start use the counter");
}
Run Code Online (Sandbox Code Playgroud)
明显:
PerformanceCounterCategory.Create("DemoCategory", "Demo category",
PerformanceCounterCategoryType.SingleInstance, ccdArray);
Run Code Online (Sandbox Code Playgroud)
是抛出异常的行.
我读过PerformanceCounterPermission,我该怎么办?
我试图通过点击按钮让用户决定何时开始收集CPU使用率.在后台工作时,应用程序每秒获得总CPU使用率,并且仅在使用不同事件时停止这样做,即从不同按钮点击.我有一个小问题.当我通过按钮点击更改应用程序的状态时,我无法停止应用程序:
class CPUPerformanceMonitor
{
PerformanceCounter cpuCounter;
List<float> cpuUsage;
private delegate void start();
start sc;
IAsyncResult iftar;
MeasureState currState;
public CPUPerformanceMonitor()
{
cpuCounter = new PerformanceCounter();
cpuUsage = new List<float>();
sc = new start(StartMeasuring);
currState = MeasureState.Measuring;
cpuCounter.CategoryName = "Processor";
cpuCounter.CounterName = "% Processor Time";
cpuCounter.InstanceName = "_Total";
}
public void Start()
{
currState = MeasureState.Measuring;
iftar = sc.BeginInvoke(null, null);
if (currState == MeasureState.NotMeasuring)
{
sc.EndInvoke(iftar);
}
}
private void StartMeasuring()
{
cpuUsage.Add(cpuCounter.NextValue());
Thread.Sleep(1000);
// if (currState != MeasureState.NotMeasuring)
// { …Run Code Online (Sandbox Code Playgroud) [我的尝试]
已经经历了
如何在C#中获取CPU使用率? 但是,“ _ Total”处理器实例将给我CPU的总消耗,而不是特定的应用程序或“进程”
任务管理器中的CPU时间到底是什么?,对此进行了解释,但没有说明如何获取此值。
收到
TotalProcessorTimeCounter = new PerformanceCounter("Process", "% Processor Time", processName);
Run Code Online (Sandbox Code Playgroud)
基线为(逻辑CPU数量* 100)基本上,这不能使我超出CPU消耗100%的比例。
尝试在任务管理器中进行挖掘,发现任务管理器->处理器-> CPU使用量的等级为100。
Processor \%Processor Time对象不使用进程名称作为输入。它只有“ _Total”作为输入。
[题]
对于多核系统的特定进程,如何使用性能计数器(范围为100)获取此数据(CPU消耗)?
我正在尝试使用NextValue的PerformanceCounter课程PhysicalDisk。我似乎无法找出原因的某些原因,0每次都会返回。
PerformanceCounter pcDiskTime = new PerformanceCounter("PhysicalDisk", "% Disk Time", "_Total");
Single sinDisk = pcDiskTime.NextValue(); //returns 0.0
Run Code Online (Sandbox Code Playgroud)
使用上面的方法并调用pcDiskTime.NextValuereturn的0。我还有其他工作正常的柜台,可以退还我需要的东西。
.RawValue确实返回了一些东西,但不是我需要的值。是否有明显的我没有做的事情?
注意:我已经通过Performance Monitor这些验证了确实是正确的类别,计数器名称和实例名称。我还尝试过.NextValue()两次打电话,有时是第一次回电话0.0,但这无济于事。
c# ×4
asynchronous ×1
azure ×1
benchmarking ×1
c ×1
c++ ×1
cpu-usage ×1
frame ×1
frame-rate ×1
linux ×1
perf ×1
performance ×1
windows ×1
x86-64 ×1