09-27-2019
12:13 AM
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
09-27-2019
12:13 AM
I'm running the test using a small C# executable to launch, monitor and kill AutoCAD:
using System;
using System.Diagnostics;
using System.Threading;
namespace acadWatcher
{
class Program
{
static void Main(string[] args)
{
int runCount = 0;
for (; ; )
{
++runCount;
Console.Out.WriteLine("Attempt #" + runCount);
Process p = new Process();
p.StartInfo.FileName = "C:\\Program Files\\Autodesk\\AutoCAD 2020\\acad.exe";
p.StartInfo.Arguments = "/product ACAD /b \"C:\\users\\steve\\desktop\\startup.scr\"";
p.Start();
string processName = p.ProcessName;
Console.Out.WriteLine("AutoCAD launched (process name = " + processName + ").");
PerformanceCounter pc = new PerformanceCounter("Process", "% Processor Time", processName);
float usage = pc.NextValue();
float[] usages = new float[30];
// For 30 seconds, check every second for the CPU usage.
for (int f = 0; f < 30; ++f)
{
Thread.Sleep(1000);
usage = pc.NextValue();
usages[f] = usage;
Console.Out.WriteLine("" + (f < 9 ? " " : "") + (f + 1) + ": CPU usage = " + (int)usage + "%");
}
// Test average of last 10 seconds.
float total = 0;
for (int f = 20; f < 30; ++f)
total += usages[f];
float average = total / 10;
Console.Out.WriteLine("Average CPU usage over last ten seconds was " + (int)average + "%");
if (average > 40)
{
Console.Out.WriteLine("This EXCEEDS the given limit of 40%. Stopping.");
break;
}
p.Kill();
}
}
}
}Here is the contents of the startup script, just one empty comment line. The main purpose of this is so that AutoCAD launches with an empty drawing rather than the usual startup window.
;
I ran a test yesterday that went for 660 iterations. I'm not sure, but I think it's because the mouse pointer was sat on the windows taskbar for almost the entire run, and not anywhere near the AutoCAD window. As soon as I put the mouse pointer over the main desktop area where the AutoCAD window was appearing, it failed within two runs ... so I'm thinking it might possibly be related to graphics/rendering?