Performance & Diagnostics for Background Task - windows-runtime

I see how to use Debug->Performance and Diagnostics for the main UI project, but how can I use these tools for a background task?
Specifically I care about making sure my background task is staying within time/memory constraints when network could be poor.
Another idea, was to toast the memory usage from my bg task, but there isn't a way a background task can know the current memory usage b/c the MemoryManager class doesn't exist for Windows Runtime Components (which all bg tasks have to run as).

My best guess at an answer is using the "Windows Phone Developer Power Tools(8.1)" included with the SDK.
You put a breakpoint on the first line of your background task code. Then (since its running) use power tools to select performance monitor and then "BACKGROUNDTASKHOST" as the process. For me ~2.2MB is used right away in the private bytes. Put a breakpoint at the end of your background task and see how much it goes up. After the bg task is done, then it will be gone from power tools.

Related

Chrome Developer tools missing timeline views

So under timeline I would normal see options such as Events, Frames, Memory in the upper left but I no longer do. I'm not sure what I did but what I have there now is two checkboxes: capture stacks and capture memory. How can I get back the original setup?
They updated the interface, I'm pretty sure all the functionality is still available.
(In timeline view)
* Event mode is the default.
* Frames mode can be toggled with the icon next to the trash can.
* Memory can by turned on by checking the capture memory checkbox.
It is in-fact disappointing to see such a feature missing from chrome dev tool. FPS meter can be used to get similar information, but not as good as seeing info realtime in Timeline.
In addition to this, for memory details the following script from paulirish is useful,
https://github.com/paulirish/memory-stats.js
It moved into Performance Analysis Reference: https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference

Clojure agents: rate limiting?

Okay, so I have this small procedural SVG editor in Clojure.
It has a code pane where the user creates code that generates a SVG document, and a preview pane. The preview pane is updated whenever the code changes.
Right now, on a text change event, the code gets recompiled on the UI thread (Ewwwww!) and the preview pane updated. The compilation step should instead happen asynchronously, and agents seem a good answer to that problem: ask an agent to recompile the code on an update, and pass the result to the image pane.
I have not yet used agents, and I do not know whether they work with an implicit queue, but I suspect so. In my case, I have zero interest in computing "intermediate" steps (think about fast keystrokes: if a keystroke happens before a recompilation has been started, I simply want to discard the recompilation) -- ie I want a send to overwrite any pending agent computation.
How do I make that happen? Any hints? Or even a code sample? Is my rambling even making sense?
Thanks!
You describe a problem that has more to deal with execution flow control rather than shared state management. Hence, you might want to leave STM apart for a moment and look into futures: they're still executed in a thread pool as agents, but instead of agents they can be stopped by calling future-cancel, and inspecting their status with future-cancelled?.
There are no strong guarantees that the thread the future is executing can be effectively stopped. Still, your code will be able to try to cancel the future, and move on to schedule the next recompilation.
agents to indeed work on a queue, so each function gets the state of the agent and produces the next state of the agent. Agents track an identity over time. this sounds like a little more than you need, atoms are a slightly better fit for your task and used in a very similar manner.

trace the data flow when the executable is running

I am practicing reversing skill using OLLdbg under windows.
there is an interactive window asking you input, let's say "serial number". My question is when user operate on the window, it is hard to locate related data flow within the debugger window. For example, if I click "F9", we can view the instruction flow; but When inputing on the window, I can't know which instructions have been executed.
My target is to find some jump instruction and change it, so that I can bypass the correct input requirement. I think the instruction should be quite close to instruction related to arg#, and related to TEST command.
Looking for hint or trick. Thanks.
One thing you could do is type something in the text field and then use an application such as Cheat Engine to find out where in the memory these characters are stored. Then you can put a memory (on access) breakpoint on the address of the first character in ollydbg. Then press the button that verifies the serial. When an instructions accesses this part of the memory it will break. You're inside a part of the code that verifies your string. Now from here you have to try to understand what the code is doing to find the instruction you want to alter.
Depending on how secure the application is, this will work. With a more secure application this most likely won't work. When your just starting reverse engineering I suggest you find some easy applications made for cracking and work your way to the more secure applications. A site where you can find many of these "crackmes" is crackmes.de. Also i can suggest lene151's tutorials here. Some of the best tutorials I've seen on reverse engineering.

Where to configure Hudson node disk/temp space thresholds?

I am currently running a Hudson instance on a VM slice. As I don't have a need to run more than a couple small applications from it, I'm minimizing how much space I devote to it. The sizes I've defined for this slice seem fine to me, however Hudson seems to have it's own ideas on what are considered minimum disk and temp space thresholds.
And then I look at the Node and I see the following:
546MB does not seem like too little space for running my small number of applications, but Hudson seems to disagree. Is there any place I can configure Hudson to redefine what it considers too low for disk and temp space?
It is configurable from the web interface:
Hudson > Nodes > Configure > Preventive Node Monitoring > Free Disk Space (defaulted to 1GB)
You might also want to change Free Temp Space whilst you're there.
Be aware that you'll need to give Hudson some time to pick up on the change after you save it. So if the free disk space warning doesn't disappear as soon as you return to the nodes page, don't worry - the disk space monitor only runs once an hour.
Since Hudson 1.339 it is configurable.
See here http://wiki.hudson-ci.org/display/HUDSON/Features+controlled+by+system+properties
The property is called
hudson.diagnosis.HudsonHomeDiskUsageChecker.freeSpaceTheshold
It's not configurable. Just turn off the monitors, so your nodes stay online.
See issue HUDSON-2552 for a fix. The code is not yet part of Hudson though.

Is there any way to monitor the number of CAS stackwalks that are occurring?

I'm working with a time sensitive desktop application that uses p/invoke extensively, and I want to make sure that the code is not wasting a lot of time on CAS stackwalks.
I have used the SuppressUnmanagedCodeSecurity attribute where I think it is necessary, but I might have missed a few places. Does anyone know if there is a way to monitor the number of CAS stackwalks that are occurring, and better yet pinpoint the source of the security demands?
You can use the Process Explorer tool (from Sysinternals) to monitor your process.
Bring up Process Explorer, select your process and right click to show "Properties". Then, on the .NET tab, select the .NET CLR Security object to monitor. Process Explorer will show counters for
Total Runtime Checks
Link Time Checks
% Time in RT Checks
Stack Walk Depth
These are standard security performance counters described here ->
http://msdn.microsoft.com/en-us/library/adcbwb64.aspx
You could also use Perfmon or write your own code to monitor these counters.
As far as I can tell, the only one that is really useful is item 1. You could keep an eye on that while you are debugging to see if it is increasing substantially. If so, you need to examine what is causing the security demands.
I don't know of any other tools that will tell you when a stackwalk is being triggered.