samedi 18 février 2017

Do I need to use thread for testing code execution speed in android?

I need to benchmark this code:

public static String foo () {

     final long startTime = System.nanoTime();
     try {
         // my code here
         final long endtime = System.nanoTime();
         System.out.println ("Total execution time:" + (endtime - startTime));
         return msg;
     } Catch (GeneralSecurityException e) {
         return "ERROR";
     }
 }

Im gonna execute this code in 2 different android device with quadcore, do I need to use thread for benchmarking like this? if I execute it without thread will it affect the output?

Aucun commentaire:

Enregistrer un commentaire