Java Mission Control (JMC) 6.0 does not show hot methods when examining a JFR flight recording - profiling

After using the Java Flight Recording functionality on a running application, Java's JMC could be used to examine the resulting JFR file to show hot methods, and a percentage of CPU time spent in each method. This was very useful for profiling applications and identifying bottlenecks.
Here is an example of what was previously possible in older versions of JMC:
This screen seems to be missing in JMC 6.0 that is bundled with Java 10. Here is an example of what I see in the Java 10 bundled JMC 6.0:
There seems to be a rudimentary count of method calls, but no Percentage CPU time is listed. There don't appear to be options to add the missing column.
Is there a way to show hot method %CPU time, or has this functionality been removed from JMC 6.0 in JDK10?

The percentage column is not cpu time, but percentage of the total number of method samples.
The same info is displayed as the backdrop in the Count column in JMC 6.0, and I believe if you hover over the column to get the tooltip there might be a percentage number.
I know you are not the first person to miss the percentage column, there is an enhancement request in the JMC Jira for this: https://bugs.openjdk.java.net/browse/JMC-5721

At time of writing JMC 7.1.2 still doesn't give the chance to see the percentage CPU time. I've found great help read jfr files with VisualVM -> Sampler -> Display -> CPU

Related

Is there a way to monitor the cpu and power consumption of an individual app on a smartwatch (android wear)?

I was wondering if there is a way to monitor the cpu and power consumption of an individual app on a smartwatch (android wear) remotely such as through the Android studio or something little eye which is not accessible anymore ? The usual handheld apps such as power tutor and trepn doesn't fit the screen of the watch.
Any suggestions would be appreciated on somehow adapting these apps to work on watch or anything else ?
Regards
Try System Info app for Android wear. Download it from Google Play. Screenshot of their app shows a monitoring dashboard that fits the android watch's screen.
Yes! you can use the Battery Historian to get very detailed information about wake-locks, CPU usage, VM usage, CPU temperature.. the list goes on.
After putting your watch in Developer Mode, run :adb bugreport > battery_stats.txt and feed the battery_stats.txt file to the battery historian. It will output detailed information about all apps and the system in general, with the option of seeing stats for the app of your choice.
I finally used power tutor (battery consumption) and dumpsys cpuinfo for these measurements.
Power tutor does not provide correct power values when it comes to absolute values, however, it works for relative comparison of various apps (power consumption) which was the case with my situation.
http://ziyang.eecs.umich.edu/projects/powertutor/
https://developer.android.com/studio/command-line/dumpsys.html

How to create a report generator in word

I am currently trying to figure out to to make it so I can load a template for word and be prompted to fill in data that will then be populated on the word document. The report has a 2 main sections. The first in the over view:
The summary will be calculated automatically.
The second section is the summary where data will be appended:
There are several approaches to report generation in Word, each with its pros and cons:
1. Automate report generation in MS Word itself (or other VBA enabled MS Office applications), using VBA modules:
In this case you will need to have MS Word installed on the machine, where the report generation will take place. You will also have to allow execution of scripts in Word VBA modules. After the document is open, VBA can start executing and there you can do pretty much anything - like connecting to some source of external data, filling this data into the Word template. I have been using bookmarks in Word as placeholders for the data. In this way you can also fill tables - just put the bookmark in the first cell, jump to this bookmark and then programmatically fill data one cell at the time and then programmatically move to the adjacent cell and when you are in the last cell in a row the new row opens and you are in the first cell of the new row.
However, you have to be careful how to release WINWORD processes after you are done with document generation. VBA is no longer supported in Office 2013, so this is probably not the best solution.
2. Use Interop assemblies in .NET to do this programmatically: To start with, there is an article on MSDN about using a Word template and manipulate it programmatically. You can find this article here. Again you will need Word installed on the machine where you run the code. You can achieve results very quickly, but note that it is not designed run on a server, because you may soon have performance issues and memory leaks.
3. Use OperXML SDK to programmatically manipulate Word documents from managed .NET application: This gives you total freedom in document generation, but the learning curve is long and steep. Depending on the scale of your business domain you may consider investing your time in learning this technology.
4. Use some of the third party Tools:
In my case I didn't want to use OpenXML. I have replaced VBA-based report automation as explained above with SDK toolkit for Word template generation and report automation. You can check this link for an example. So far this toolkit has covered all our needs, so I am not looking any further. I prepared my first templates about 3 years ago using this toolkit and they smoothly survived migrations from Office 2007 to 2010 to 2013. Now I have a library of about 90 different Word templates which are being used by different applications, using this toolkit in the background. Its kind like 'set it and forget it', and it saves me quite a bit of time compared to VBA document automation which we used before.

SQLite query progress bar

I am using sqlite from c++ and I want to implement a progress bar that will inform user about the progress of a search.
Using sqlite3_progress_handler I can set ca callback to be called every N virtual machine instructions. This is ok for an infinite progress bar that is notifying user the app is still working.
What I need is a progress from 0 -> 100%. Can this be done ?
I realize that this is a bit late, and that this question already has an accepted answer, but I think a little more information would be useful.
As the OP noted in the question, the sqlite3_progress_handler can be configured to call the callback function every N VM instructions. This is not a time progress monitor or a query statement progress monitor, but a monitor for the VM instructions that the query planner has calculated for the query (which will do in a pinch).
By prefacing the query with 'EXPLAIN QUERY PLAN' (or just 'EXPLAIN' for short) and stepping the results to get a count, you will know how many VM instructions are in the query plan. There's your 100% figure.
BE SURE to read the caveats on the SQLite.org website about the EXPLAIN QUERY PLAN command, especially the part about not relying on the output format. But for this situation, we're not concerned with the information in the results, but only the number of instructions.
As of SQLite version 3.24.0 (2018-06-04), the output format for the EXPLAIN QUERY PLAN command diverged significantly from the EXPLAIN command. EXPLAIN QUERY PLAN is no longer suitable for this use case; you have to specify the EXPLAIN command itself.
To be clear, the EXPLAIN command is not published as supporting the sqlite3_progress_handler() API. The fact that it can be used in this case is purely coincidental. You should always test that this works on whichever version of SQLite you are using.
It is not possible for the database to predict how much time (or how many VM instructions) a query will need.

Django Toolbar gives different times when same template is loaded

When using the Django debug toolbar, it says a page might load in say 4000 ms. But when we reload the page (with ctrl+F5 to clear the cache) it says it loads in say 4400 ms -- or 3600 ms. Is there a more accurate way to benchmark the load time? The reason is that we want to optimize page load times and want to make sure that we can see cause and effect clearly.
There will always be some variation in the amount of time it takes a program to do anything--on a typical computer there are tens to hundreds of processes simultaneously competing for resources, so the exact load time will vary depending on how much else is going on at that exact moment.
The best way to benchmark is not to look at the time take by a single page load, but rather the average time over a bunch of loads. There are many tools to help you do that--Apache jMeter is one.
You may also want to look into profiling your app rather than just measuring the overall load time--that will help you identify which bits of your code are called most frequently and contribute the most to the total time taken. Guess-and-check optimizations are likely to be much more time consuming. See the Django docs or Google "profiling django" many more resources.

Ms chart controls for automated report/metrics generation to image, web or win forms?

Are there reasons to go one way or the other?
System.Web.UI.DataVisualization vs. System.Windows.Forms.DataVisualization
I'm building a process for a build server, where it will simply output a chart to an image based on a sql data rows fetched at run-time. I don't have anything vested in either direction, and have experience in both worlds, but none in Ms Charting.
I assume there are good reasons to go either way.
What are the things to consider about going either direction?
We went the WinForms route because it took a long time for our data intensive charts to be generated on the fly. With a service you can have the charts generated slightly ahead of time (5 minute cycle for us) and as a result the webpage loads instantly. Also this means that at most our DB is queried 1 time every five minutes whereas each person who loads the web chart would hit the database individually resulting in a lot more load on the DB.