I've written an application, it's a big one and it has lots of features.
But I have a problem with it: in the phone battery usage it takes about 35 percent of battery and it's a huge problem even when I don't use it very much.
I've no services in my application and I really don't know where the problem is.
Is there any way that I can find out what is using my battery?
I am using PowerTutor for this purpose when i am testing my application performance and battery usage. Even i am using this application also https://developer.qualcomm.com/software/trepn-power-profiler. Please try this let me know if it helps you.
Related
I am trying to speed-up my application.
Will it make my app significantly faster if I remove all the logs-code? Does it make a difference ?
My app writes lots of logs.
Log.v(TAG, "example android log");
I read this question, but it doesnt answer my question.
No, it won't make any visible improvements on your perfs.
Unless you're doing really bad things such as:
Non-stop logging (100x every frame)
String concatenations
toString() method calls
any object allocation
Maybe you could share some snippets of your logging code to see if there is anything wrong.
Depends on the functionalities of you Glass app. If your glass app is just a slideshow there are different aspects that needs to be taken care of than a Media Streaming app. Offcourse, reducing the number of log statements would help a bit in the performance but there are other significant points that should be taken into consideration.
Please refer to this official Google Document for more detail information.
I have been trying to figure this out since couple months ago because I'm working on my thesis, but unfortunately I have not been able to make it. What I'm doing is a performance analysis regarding energy consumed by an application running an algorithm locally on the phone and the same app but running the algorithm on the cloud and getting the response back to the phone. What I want to do is to try to find an accurate way to obtain the energy consumed by this algorithm since it's executed until it gets the solution (locally and remotely).
Is there any way that I can use in java to do it by using the Android API? I would like to write my own code to get the measures. Please anything you guys think it is helpful PLEASE, let me know... I appreciate your time and patience,
Alberto.
I am not sure if there is such an API available. Here is a link with similar discussion. If you want because energy/battery consumption depends on may other factors including the efficiency of the compiler.
How can we increase the performance of an application. My application is written using Java, Hibernate, Servlets, Wsdl i have used for web services. I have executed some of the tests on linux machine, so that i can get proper TPS of the execution.
but still , i am not satisfied by the performance.
So for this, what all steps i should try to increase the performance.
adding to above, i have executed code coverage and used find bugs in the code prominently for each and every test and every service i have written.
Individual suggestions are invited.
Thanks.
Profile your application, and remove all of your bottlenecks.
In addition, or better before, take a day or two and read as much from the Java Performance Tuning newsletters as you understand.
You should monitor your application with a tool like VisualVM, JProfiler etc. to determine the performance bottleneck(s). It is pointless to tune the application without knowing where the actual performance problems are located.
In a professional environment, I suggest dynaTrace that can show you performance bottlenecks along the execution path. The tool can show you exactly where the application spends its time.
Is the performance related to disk I/O or network I/O? In a high throughput system (from DB point of view) Hibernate might not be the best way to go. If you have a lot of writes I would recommend you use a different mechanism to write to database -- perhaps simply switching to simple JDBC might speed it up?
Secondly, is it the case that your webservices are taking too long to get back with results? SOAP is not the fastest protocols really -- have you looked at something like REST maybe coupled with JSON ?
I am having trouble finding a class or API in Android documentation that would help me get battery usage statistics per application.
I have read PowerManager and BatteryManager classes but they are of no use.
However, I can find applications like PowerTutor that do provide battery usage statistics per application, so I think it's technically possible.
Can any one point me in right direction?
I'd be surprised if such an API exists. Rather, I expect that PowerTutor is using some sampling heuristics to estimate how much of the current battery usage to blame on each application.
I'm asked to shorten the start-up period of a long starting app, however I have also to obligate to my managers to the amount of time i will reduce the startup - something like 10-20 seconds.
As I'm new in my company I said I can obligate with timeframe of months (its a big server and I'm new and I plan to do lazy load + performance tuning).
That answer was not accepted I was required to do some kind of a cache to hold important data in another server and then when my server starts up it would reach all its data from that cache - I find it a kind of a workaround and I don't really like it.
do you like it?
What do you think I should do?
PS when I profiled the app I saw many small issues that make the start-up long (like 2 minutes) it would not be a short process to fix all and to make lazy load.
Any kind of suggestions would help.
Language is Java.
Thanks
Rule one of performance optimisation: measure it. Get hard figures. At each stage of optimisation measure the performance gain/loss/lack of change. You (and your managers) are not in a position to say that a particular optimisation will or will not work before you try it and measure it. You can always ask to test & measure a solution before implementing it.
Rule two of performance optimisation (or anything really): choose your battles. Please bear in mind that your managers may be very experienced with the system in question, and may know the correct solution already; there may be other things (politics) involved as well, so don't put your position at risk by butting heads at this point.
I agree with MatthieuF. The most important thing to do is to measure it. Then you need to analyze the measurements to see which parts are most costly and also which resource (memory, CPU, network, etc) is the bottleneck.
If you know these answers you can propose solutions. You might be able to create small tests (proof of concepts) of your solution so you can report back early to your managers.
There can be all kind of solutions for example simply buying more hardware might be the best way to go. It's also possible that buying more hardware will have no results and you need to make modifications. The modifications can be optimizing the software, the database or other software. It might be to choose better algorithms, to introduce caching (in expense of more memory usage) or introduce multi threading to take advantage of multiple CPU cores. You can also make modifications to the "surroundings" of your application such as the configuration/version of your operating system, Java virtual machine, application server, database server and others. All of these components have settings which can affect the performance.
Again, it's very important to measure, identify the problem, think of a solution, build solution (maybe in proof of concept) and measure if solution is working. Don't fall in to the trap of first choosing a solution without knowing the problem.
It sounds to me as if you've come in at a relatively junior position, and your managers don't (yet) trust your abilities and judgment.
I don't understand why they would want you to commit to a particular speed-up without knowing if it was achievable.
Maybe they really understand the code and its problems, and know that a certain level of speed-up is achievable. In this case, they should have a good idea how to do it ... so try and get them to tell you. Even if their ideas are not great, you will get credit for at least giving them a try.
Maybe they are just trying to apply pressure (or pass on pressure applied to them) in order to get you to work harder. In this case, I'd probably give them a worth-while but conservative estimate. Then spend some time investigating the problems more thoroughly. And if after a few days research you find that your "off the cuff" estimates are significantly off the mark, go back to the managers with a more accurate estimate.
On the technical side, a two minute start-up times sounds rather excessive to me. What is the application doing in all that time? Loading data structures from files or a database? Recalculating things? Profiling may help answer some of these questions, but you also need to understand the system's architecture to make sens of the profile stats.
Without knowing what the real issues are here, I'd suggest trying to get the service to become available early while doing some of the less critical initialization in the background, or lazily. (And your managers' idea of caching some important data may turn out to be a good one, if viewed in this light.) Alternatively, I'd see if it was feasible to implement a "hot standby" for the system, or replicate it in such a way that allowed you to reduce startup times.