At work I am using Ubuntu and at home I am using windows 7. I would like to know how can I benchmark my android application on Ubuntu and windows 7.
You can use DDMS and Systrace to break down what your app is doing and for how long.
As for "benchmarking," what do you mean by that? Do you want to see how long it takes to do something in your app?
It's usually more useful to just make sure you're doing things in the fastest way possible, rather than within a certain time window.
I wrote a code to specifically benchmark specific part of the code that I want. you can find it here:
http://farzad.devbro.com/android_benchmark/Devbro_Benchmark.java
Here is an example of the code to use:
Devbro_Benchmark.markStart("Label2"); //mark a begining
for(int i=0;i<1000;i++)
{
//you can create multiple markers at once. If you use the same marker name
//it will simply add up the times for you
Devbro_Benchmark.markStart("Label1");
//some random code
Devbro_Benchmark.markEnd("Label");
}
Devbro_Benchmark.markEnd("Label2"); // mark an ending
//once you are done with your markers you can display an extensive report which will be
//shown using the Log.d
Devbro_Benchmark.print_report();
//once you are done you can reset before redoing it.
Devbro_Benchmark.reset();
There are now two Jetpack benchmarking libraries. from the Android team.
Macrobenchmarking: Allows you to benchmark entire workflows
Microbenchmarking: Enables benchmarking specific code in isolation.
Related
I am working on a project in Java that involves fitting a simple linear regression line through a rolling / sliding window of n data points. For each new point added the linear regression slope and intercept need to be re-calculated. We currently use org.apache.commons.math3.stat.regression.SimpleRegression to do this calculation, but it is expensive to re-calculate the entire window each time.
So I have two questions.
The SimpleRegression offered by apache commons has a removeData method for use in a "streaming mode". (See quotation below taken from API). However there is no other information on this "streaming mode"; proper implementation,accumulative error, etc... Does anyone have an example of how to use it properly in streaming mode? or can anyone point me to a better source of information?
"This method permits the use of SimpleRegression instances in streaming mode where the regression is applied to a sliding "window" of observations, however the caller is responsible for maintaining the set of observations in the window.
"
Are there any other libraries available that can do streaming linear regression in constant time? Surely Apache Commons SimpleRegression is not the only one... but that seems to be the only one I can find...
Thanks,
g
By looking at the source code I suppose this only means there is the method removeData which reverses the calculations done by addData. So the caller has to remember the data in the window and remove it one by one when the data "exits" the window.
I am going to research on which key typed most in which hour in a 24-hour-day?
Later, I would research on which word used most in which hour in a 24-hour-day?
Say in the evening you would find most used word good or bye as people usually ends up their meeting in the evening.
So, I need to record keystrokes on the background using a java application with a time-stamp.
My questions are:
How to run a java program on the background?(Obviously informing the user).
How to record keystrokes which are used in other applications and counted in the java application without affecting its original application?
Note that:
This question does not serve my problem. Though it has an accepted answer, but the answer is not helpful for me because it could not distinguish between uppercase and lowercase letter, it returns same ASCII character. It just gave some sources and some other files. I expect more readable answer and a clear view how the java program launch on the start up and run on the background.
Just a little information to get you moving in the right direction. What you are looking to implement to listen for the keystrokes is KeyListener. I believe the actual function is keyTyped(ActionEvent e) but am not sure.
Other then that to run a program silently in the background will probably require some manipulation of the window + windows properties. You could just have the program run without a UI, or create a very lightweight UI that posts data. If you are looking for an actual "out of sight out of mind" background process, I am not sure how to do this with Java. However I imagine just an un-intrusive GUI would be sufficient for your purposes.
I'm looking for a way to specify an output device with JavaFx
I have a similar issue as this question: JavaFX specific Audio Output, but with different needs.
I need a way to get a list of all possible Audio Output devices (like the one you see in your user preferences) and allow the user to select which one they want the audio to come out of in JavaFx. This seems like a really basic feature that should be in any music/media API, and is essential for most audio software.
I'm using the MediaPlayer in JavaFx, though if there is another class I'm happy to use it. Note though that I need the same functionality for video (specifying audio output), so I need a class/solution that works for both.
If there's something in JavaFx 8 that will help, I can always wait until it is released.
What I really expected there to be was the same thing as the Screens class:
Screen.getScreens() // Gets an observable list of all screens.
I'm fine with hackish solutions. Really, anything that works.
For years it has been a very unfortunate limitation of the Java implementation for OS X, being BTW particular for that platform, that "Java Sound Audio Engine" is the only programmatically available output audio line. In consequence, whatever you send to this line, i.e. out from any java application that you make, will always be routed to what has been set as the default output in the OS X, typically internal speakers. So the JSAE is just Java terminology for "default audio out". To our understanding - sadly - this is still the case with latest release.
Why unfortunate ? Because it effectively disables even humble audio routing. We are working with these matters on a daily basis, and it calls for all sorts of added complexity. There are work arounds, but via third party apps as SoundFlower and HiJack Pro. www.soundPimp.com for example.
As assylias has pointed out getmixerinfo method can help you
Info[] mixerInfo = AudioSystem.getMixerInfo();
for(int i = 0; i < mixerInfo.length; i++)
{
System.out.println(mixerInfo[i].getName());
}
You can explore further details here
I'm using Marthon to run tests on a Java Swing application. I build the base tests by recording, then just make small modifications to the resulting Ruby tests to tweak it to fit what I need. I've run into an interesting problem where comboboxes selections do not work. For example, it'll record...
select("Value", "0.25")
...for the Value combobox, which has a valid option of 0.25 in it. However, during playback, the script pauses execution at that point. If I manually click on the combobox (just to drop it down, not actually selecting anything), then the script will select the right number and continue on.
The problem exists for ALL (so far tested) comboboxes in my application, but none of the other control types. Is there a way to select a value in the combobox that works? I don't mind tweaking the recorded script, I just want to not have to manually click on all my comboboxes each time they're in the script!
Have a look at the object map files for the window and change the recognition properties. That should make this consistent.
The _2 basically means that Marathon is unable to find unique properties to identify the components.
Well, I figured it out already... Apparently the recorder just does a poor job at figuring out the correct label for comboboxes. I was able to get some to work by removing the "_2" or whatever at the end. Others, it took incrementing that number. So, apparently the way the recorder sees the screen layout is different from what the player sees.
edit
The newest version of Marathon appears to have fixed whatever was ailing it before. I'm now unable to duplicate the problem.
I'm getting a list of packages installed in an Android devices very similar to the code here - http://www.androidsnippets.com/get-installed-applications-with-name-package-name-version-and-icon
The problem is that it takes quite a while to complete detection of all apps. I've discovered that the slow operations are those that call p.applicationInfo.loadLabel() and p.applicationInfo.loadIcon(). Once I comment those out and set them to dummy info, the detection is almost instantaneous.
Since I would still like to retrieve the app name and icon, I can't simply comment them out. Is there a faster way of retrieving this data?
Thanks.
You should populate the list with the names of the applications first and placeholders in place of the icons.after this another thread should fetch the icons sequentially and list should be notified for data set changed every time.