In TwinCAT, is there a way to get the real time (isolated) CPU usage from outside of the PLC code? - twincat

The CPU usage of non-RT cores is available in MDP (either over ADS or UA), but I'm unable to find any way to get the CPU usage of isolated cores from user land (i.e. Windows).
I feel like there should be an easy way to read this since TcXaeShell is able to display the RT core usage in a chart.
Does anyone know how to do this, or, as a last resort, how to sniff out the protocol that TcXaeShell is using to get this info?
UPDATE: Thanks to the insight from the comments below that the TC_CpuUsage FB is just using ADS reads in the background, I was able to find the ADS parameters I needed inside the TC_CpuUsage FB:
At first I had missed the detail that the AMS port should be that of the TwinCAT Real Time Server (200), and not that of the runtime port (default 851), so I was getting an ADS error. Once I changed the port, I was able to get the CPU usage of RT cores over ADS in my .NET application.

Isn't TC_CpuUsage function block what you are looking for? If you wish to get CPU usage of more than 1 core, you need to run an instance of this FB in each program that is assigned to task from each core.

Related

How to profile set of process in freeBSD?

I am trying to debug a service with respect to its performance. The service I am trying to debug, internally spawns instances of the same binary. To improve the through-put, I am planning to increase number of instances of the binary. After a point in number of processes of the binary, through-put is not increasing. Now I am trying to reason-out why this is happening.
I need some help on where to start, tools available for process level profiling. I am using freeBSD platform.
If using more processes doesn't improve output, then your service isn't CPU bound. It might be constrained by e.g. disk or network throughput instead.
Start with systat. Especially systat -vmstat. See man systat.
This will show you several aspects (like memory usage, interrupts, processot usage and disk activity) of how busy your system is.
If your program does a lot of network activity, using systat -tcp might give insight as well.
If your service is a HTTP server, you might want to look at varnish.

monitoring application (CPU and cache usage) on single Linux box with 80 cores

I am looking for a performance monitoring tool for my application which will collect/visualize in realtime the CPU and cache usage on single Linux box like IBM System or HP ProLiant with typical configuration 8 processors / 80 cores.
Application is the home-grown multithreaded C+ code which uses OpenMP.
This monitoring tool should not run 24 hours per day; it should not do e-mail notification.
I will run this tool just before sending commands to my apps, the apps will execute the command (it may take as a maximum few minutes only). During this time interval I need to analyze:
- usage of cores
- data movement between processors
- usage of L1, L2, L3 caches
- some other metrics (help me here) which can help to find bottleneck in application
performance and resource utilization
I guess that tools like Nagios / Zabbix are too heavy for this task.
From another side using the command-line tools like "top" and "sar" for 80 cores not very convenient and plotting (not necessary real-time) would be nice to have...
While getting the per core usage is rather easy - the other values might prove to be not practical, not at least without running that application within a profiler of some sorts.
Measuring QPI utilization is something highly non-trivial if at all possible. Intel's vTune might be able to acquire such things but only when running instrumented version of your binaries.
Also on x86 there is no way to figure out L1,L2,L3 usage of any kind - you can grab the low level CPU counters to measure cache misses though (but would probably need to use instrumented/profiled binaries and always withan something like vTune or PAPI).
You could "easily" setup something to pull all the lower level performance counters into SNMP and grab the SNMP values via standard SNMP capable monitoring tools but be aware that SNMP pulling is something that you don't want to occur more than 1-2/s max. Or pull that info into something like collectd.
I'm also having the impression that you don't understand the problem domain of monitoring tools. They are not ment to be used as low level analysis probes for finding application level/system bottlenecks - at best you could get some hints which resource (from a 10K feet view) is running under full utilization. Monitoring and alterting tools are something that operations staff needs to use to understand which part of their IT system is currently used and how, to gather historical data and predict future resource utilization and to be alerted when something breaks.
SiteScope, Hyperic or any combination of shell scripts, native OS utilities and a DB to store the results may do the job.

Is it possible to determine the size (memory footprint) of an application scoped variable in ColdFusion?

We use FusionReactor which will show the overall memory usage at the server level, but it would be useful to be able to see how much memory individual items stored in the application scope are taking up.
Have you looked at http://www.fusion-reactor.com/fr/ or http://www.seefusion.com/
I think both of these server monitors could help you out
CFSimplicity,
The Enterprise version of ColdFusion 8 and higher has the Server monitor. The Server Monitor can breakdown memory usage and find out what requests and what variable scopes are consuming how much memory. FusionReactor currently can not.
According to a post on the FusionReactor group: http://groups.google.com/group/fusionreactor/browse_thread/thread/8a017a61d17e9840/d57cef46b843207d?lnk=gst&q=memory+request#d57cef46b843207d
James Holmes said:
A CF Standard install could make use
of the Java SizeOf() class:
sizeof.sourceforge.net
sourceforge.net/projects/sizeof
Some custom code would be necessary to
create a monitor based on this, but
it does work. mxAjax / CFAjax docs
and other useful articles:
www.bifrost.com.au/blog/
Is this something that you need to do in real time and/or in production for monitoring? Or is this just something that you need for debugging?
I would suggest just using one of the JVM memory dump tools or maybe launching your app with the JRockit jvm and doing some live analysis with that.
http://www.schierberl.com/blog/coldfusion-memory-leaks-part-i-profiler-introduction/
It is possible to see the Application Scope size from ColdFusion, using FusionReactor Application Performance Monitor http://www.fusion-reactor.com - this information is currently captured and stored in one of the log files. It is also possible to visualize this information using FusionAnalytics - which is able to display and analyze the metrics which have been captured from FusionReactor. You can see an example of this here - http://docs.intergral.com/display/FA205/CF+Scope+Sizes

Windows Azure: how to measure the execution time of a code

I wanted to measure the execution time of my code running on windows azure cloud across multiple instances. Can anyone tell me how to do it.
You can enable the diagnostics logging and put the intrumentation/logging from the ap into an Azure Table. Then download into Excel or whatever for analysis. You can also capture perfmon data to do correlation (e.g. CPU vs workingset).
You have to compute this manually.
Just in case you are requesting this to derive billing information, remember that in Windows Azure, you are charged by reserved instance not necesarily "running".
If your application is "suspended" you still pay. If your code application is running, but "idling" (like 99% CPU free), you still pay the same.

CPU Utiliztion per process in Win32 API

I am doing a project on a centralized LAN management system. I need to know how many CPU cycles is each process of a remote PC consuming(as in a Task Manager )so that the network admin can close few processes,in case the CPU utilization of a system in network goes beyond acceptable rates..
I would like to know if there is a Win32 API for this requirement of mine n if so ,i request you to give me information about it..
thank you in advance..
Win32 API has lots of functions to find all kinds of information about currently running processes and threads, here's a link to the full list of them: http://msdn.microsoft.com/en-us/library/ms683223(VS.85).aspx
Explore the list and you should be able to find the function(s) there that meet your requirements, for example GetProcessTimes() returns structures that contain the amounts of time the process has executed in kernel mode, in user mode, etc.
You need to look at the performance monitor system. You can get the stats from there (in the Process counter).
Here's a (delphi) explanation of it, that's pretty good and simple to understand.
When you understand how it all works, you then need the Performance Counters API to read the data counters.

Resources