mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-31 15:12:25 +00:00 
			
		
		
		
	Updating Geekbench workload to support the latest versions of both the standard and corporate application
This commit is contained in:
		| @@ -29,33 +29,28 @@ class Geekbench(ApkUiautoWorkload): | |||||||
|     description = """ |     description = """ | ||||||
|     Geekbench provides a comprehensive set of benchmarks engineered to quickly |     Geekbench provides a comprehensive set of benchmarks engineered to quickly | ||||||
|     and accurately measure processor and memory performance. |     and accurately measure processor and memory performance. | ||||||
|  |  | ||||||
|     http://www.primatelabs.com/geekbench/ |     http://www.primatelabs.com/geekbench/ | ||||||
|  |  | ||||||
|     From the website: |     From the website: | ||||||
|  |  | ||||||
|     Designed to make benchmarks easy to run and easy to understand, Geekbench |     Designed to make benchmarks easy to run and easy to understand, Geekbench | ||||||
|     takes the guesswork out of producing robust and reliable benchmark results. |     takes the guesswork out of producing robust and reliable benchmark results. | ||||||
|  |  | ||||||
|     Geekbench scores are calibrated against a baseline score of 1,000 (which is |     Geekbench scores are calibrated against a baseline score of 1,000 (which is | ||||||
|     the score of a single-processor Power Mac G5 @ 1.6GHz). Higher scores are |     the score of a single-processor Power Mac G5 @ 1.6GHz). Higher scores are | ||||||
|     better, with double the score indicating double the performance. |     better, with double the score indicating double the performance. | ||||||
|  |  | ||||||
|     The benchmarks fall into one of four categories: |     The benchmarks fall into one of four categories: | ||||||
|  |  | ||||||
|         - integer performance. |         - integer performance. | ||||||
|         - floating point performance. |         - floating point performance. | ||||||
|         - memory performance. |         - memory performance. | ||||||
|         - stream performance. |         - stream performance. | ||||||
|  |  | ||||||
|     Geekbench benchmarks: http://www.primatelabs.com/geekbench/doc/benchmarks.html |     Geekbench benchmarks: http://www.primatelabs.com/geekbench/doc/benchmarks.html | ||||||
|  |  | ||||||
|     Geekbench scoring methedology: |     Geekbench scoring methedology: | ||||||
|     http://support.primatelabs.com/kb/geekbench/interpreting-geekbench-scores |     http://support.primatelabs.com/kb/geekbench/interpreting-geekbench-scores | ||||||
|  |  | ||||||
|     """ |     """ | ||||||
|     summary_metrics = ['score', 'multicore_score'] |     summary_metrics = ['score', 'multicore_score'] | ||||||
|     versions = { |     versions = { | ||||||
|  |         '4.2.0': { | ||||||
|  |             'package': 'com.primatelabs.geekbench', | ||||||
|  |             'activity': '.HomeActivity', | ||||||
|  |         }, | ||||||
|         '4.0.1': { |         '4.0.1': { | ||||||
|             'package': 'com.primatelabs.geekbench', |             'package': 'com.primatelabs.geekbench', | ||||||
|             'activity': '.HomeActivity', |             'activity': '.HomeActivity', | ||||||
| @@ -85,7 +80,7 @@ class Geekbench(ApkUiautoWorkload): | |||||||
|         Parameter('times', kind=int, default=1, |         Parameter('times', kind=int, default=1, | ||||||
|                   description=('Specfies the number of times the benchmark will be run in a "tight ' |                   description=('Specfies the number of times the benchmark will be run in a "tight ' | ||||||
|                                'loop", i.e. without performaing setup/teardown inbetween.')), |                                'loop", i.e. without performaing setup/teardown inbetween.')), | ||||||
|         Parameter('timeout', kind=int, default=900, |         Parameter('timeout', kind=int, default=3600, | ||||||
|                   description=('Timeout for a single iteration of the benchmark. This value is ' |                   description=('Timeout for a single iteration of the benchmark. This value is ' | ||||||
|                                'multiplied by ``times`` to calculate the overall run timeout. ')), |                                'multiplied by ``times`` to calculate the overall run timeout. ')), | ||||||
|         Parameter('disable_update_result', kind=bool, default=False, |         Parameter('disable_update_result', kind=bool, default=False, | ||||||
| @@ -118,6 +113,7 @@ class Geekbench(ApkUiautoWorkload): | |||||||
|         self.gui.uiauto_params['version'] = self.version |         self.gui.uiauto_params['version'] = self.version | ||||||
|         self.gui.uiauto_params['times'] = self.times |         self.gui.uiauto_params['times'] = self.times | ||||||
|         self.gui.uiauto_params['is_corporate'] = self.is_corporate |         self.gui.uiauto_params['is_corporate'] = self.is_corporate | ||||||
|  |         self.gui.timeout = self.timeout | ||||||
|  |  | ||||||
|     def initialize(self, context): |     def initialize(self, context): | ||||||
|         super(Geekbench, self).initialize(context) |         super(Geekbench, self).initialize(context) | ||||||
| @@ -194,12 +190,12 @@ class Geekbench(ApkUiautoWorkload): | |||||||
|                     context.add_metric(namemify(section['name'] + '_' + workload_name + '_score', i), |                     context.add_metric(namemify(section['name'] + '_' + workload_name + '_score', i), | ||||||
|                                        workloads['score']) |                                        workloads['score']) | ||||||
|  |  | ||||||
|  |     update_result_5 = update_result_4 | ||||||
|  |  | ||||||
| class GBWorkload(object): | class GBWorkload(object): | ||||||
|     """ |     """ | ||||||
|     Geekbench workload (not to be confused with WA's workloads). This is a single test run by |     Geekbench workload (not to be confused with WA's workloads). This is a single test run by | ||||||
|     geek bench, such as preforming compression or generating Madelbrot. |     geek bench, such as preforming compression or generating Madelbrot. | ||||||
|  |  | ||||||
|     """ |     """ | ||||||
|  |  | ||||||
|     # Index maps onto the hundreds digit of the ID. |     # Index maps onto the hundreds digit of the ID. | ||||||
| @@ -224,7 +220,6 @@ class GBWorkload(object): | |||||||
|                                  Power Mac G5 running in a single thread. |                                  Power Mac G5 running in a single thread. | ||||||
|         :param pmac_g5_mt_score: Score achieved for this workload on 2003 entry-level |         :param pmac_g5_mt_score: Score achieved for this workload on 2003 entry-level | ||||||
|                                  Power Mac G5 running in multiple threads. |                                  Power Mac G5 running in multiple threads. | ||||||
|  |  | ||||||
|         """ |         """ | ||||||
|         self.wlid = wlid |         self.wlid = wlid | ||||||
|         self.name = name |         self.name = name | ||||||
| @@ -247,15 +242,12 @@ class GBWorkload(object): | |||||||
|         Returns a tuple (single-thraded score, multi-threaded score) for this workload. |         Returns a tuple (single-thraded score, multi-threaded score) for this workload. | ||||||
|         Some workloads only have a single-threaded score, in which case multi-threaded |         Some workloads only have a single-threaded score, in which case multi-threaded | ||||||
|         score will be ``None``. |         score will be ``None``. | ||||||
|  |  | ||||||
|         Geekbench will perform four iterations of each workload in single-threaded and, |         Geekbench will perform four iterations of each workload in single-threaded and, | ||||||
|         for some workloads, multi-threaded configurations. Thus there should always be |         for some workloads, multi-threaded configurations. Thus there should always be | ||||||
|         either four or eight scores collected for each workload. Single-threaded iterations |         either four or eight scores collected for each workload. Single-threaded iterations | ||||||
|         are always done before multi-threaded, so the ordering of the scores can be used |         are always done before multi-threaded, so the ordering of the scores can be used | ||||||
|         to determine which configuration they belong to. |         to determine which configuration they belong to. | ||||||
|  |  | ||||||
|         This method should not be called before score collection has finished. |         This method should not be called before score collection has finished. | ||||||
|  |  | ||||||
|         """ |         """ | ||||||
|         no_of_results = len(self.collected_results) |         no_of_results = len(self.collected_results) | ||||||
|         if no_of_results == 4: |         if no_of_results == 4: | ||||||
| @@ -281,7 +273,6 @@ class GBScoreCalculator(object): | |||||||
|     """ |     """ | ||||||
|     Parses logcat output to extract raw Geekbench workload values and converts them into |     Parses logcat output to extract raw Geekbench workload values and converts them into | ||||||
|     category and overall scores. |     category and overall scores. | ||||||
|  |  | ||||||
|     """ |     """ | ||||||
|  |  | ||||||
|     result_regex = re.compile(r'workload (?P<id>\d+) (?P<value>[0-9.]+) ' |     result_regex = re.compile(r'workload (?P<id>\d+) (?P<value>[0-9.]+) ' | ||||||
| @@ -330,7 +321,6 @@ class GBScoreCalculator(object): | |||||||
|         """ |         """ | ||||||
|         Extract results from the specified file. The file should contain a logcat log of Geekbench execution. |         Extract results from the specified file. The file should contain a logcat log of Geekbench execution. | ||||||
|         Iteration results in the log appear as 'I/geekbench' category entries in the following format:: |         Iteration results in the log appear as 'I/geekbench' category entries in the following format:: | ||||||
|  |  | ||||||
|          |                     worklod ID          value      units   timing |          |                     worklod ID          value      units   timing | ||||||
|          |                         \-------------    |     ----/     ---/ |          |                         \-------------    |     ----/     ---/ | ||||||
|          |                                      |    |     |         | |          |                                      |    |     |         | | ||||||
| @@ -338,7 +328,6 @@ class GBScoreCalculator(object): | |||||||
|          |      |               | |          |      |               | | ||||||
|          |      |               -----\ |          |      |               -----\ | ||||||
|          |      label    random crap we don't care about |          |      label    random crap we don't care about | ||||||
|  |  | ||||||
|         """ |         """ | ||||||
|         for wl in self.workloads: |         for wl in self.workloads: | ||||||
|             wl.clear() |             wl.clear() | ||||||
| @@ -352,17 +341,12 @@ class GBScoreCalculator(object): | |||||||
|     def update_results(self, context): |     def update_results(self, context): | ||||||
|         """ |         """ | ||||||
|         http://support.primatelabs.com/kb/geekbench/interpreting-geekbench-2-scores |         http://support.primatelabs.com/kb/geekbench/interpreting-geekbench-2-scores | ||||||
|  |  | ||||||
|         From the website: |         From the website: | ||||||
|  |  | ||||||
|         Each workload's performance is compared against a baseline to determine a score. These |         Each workload's performance is compared against a baseline to determine a score. These | ||||||
|         scores are averaged together to determine an overall, or Geekbench, score for the system. |         scores are averaged together to determine an overall, or Geekbench, score for the system. | ||||||
|  |  | ||||||
|         Geekbench uses the 2003 entry-level Power Mac G5 as the baseline with a score of 1,000 |         Geekbench uses the 2003 entry-level Power Mac G5 as the baseline with a score of 1,000 | ||||||
|         points. Higher scores are better, with double the score indicating double the performance. |         points. Higher scores are better, with double the score indicating double the performance. | ||||||
|  |  | ||||||
|         Geekbench provides three different kinds of scores: |         Geekbench provides three different kinds of scores: | ||||||
|  |  | ||||||
|             :Workload Scores: Each time a workload is executed Geekbench calculates a score based |             :Workload Scores: Each time a workload is executed Geekbench calculates a score based | ||||||
|                               on the computer's performance compared to the baseline |                               on the computer's performance compared to the baseline | ||||||
|                               performance. There can be multiple workload scores for the |                               performance. There can be multiple workload scores for the | ||||||
| @@ -371,18 +355,15 @@ class GBScoreCalculator(object): | |||||||
|                               workload is executed four times (single-threaded scalar code, |                               workload is executed four times (single-threaded scalar code, | ||||||
|                               multi-threaded scalar code, single-threaded vector code, and |                               multi-threaded scalar code, single-threaded vector code, and | ||||||
|                               multi-threaded vector code) producing four "Dot Product" scores. |                               multi-threaded vector code) producing four "Dot Product" scores. | ||||||
|  |  | ||||||
|             :Section Scores: A section score is the average of all the workload scores for |             :Section Scores: A section score is the average of all the workload scores for | ||||||
|                              workloads that are part of the section. These scores are useful |                              workloads that are part of the section. These scores are useful | ||||||
|                              for determining the performance of the computer in a particular |                              for determining the performance of the computer in a particular | ||||||
|                              area. See the section descriptions above for a summary on what |                              area. See the section descriptions above for a summary on what | ||||||
|                              each section measures. |                              each section measures. | ||||||
|  |  | ||||||
|             :Geekbench Score: The Geekbench score is the weighted average of the four section |             :Geekbench Score: The Geekbench score is the weighted average of the four section | ||||||
|                               scores. The Geekbench score provides a way to quickly compare |                               scores. The Geekbench score provides a way to quickly compare | ||||||
|                               performance across different computers and different platforms |                               performance across different computers and different platforms | ||||||
|                               without getting bogged down in details. |                               without getting bogged down in details. | ||||||
|  |  | ||||||
|         """ |         """ | ||||||
|         scores_by_category = defaultdict(list) |         scores_by_category = defaultdict(list) | ||||||
|         for wkload in self.workloads: |         for wkload in self.workloads: | ||||||
| @@ -407,9 +388,8 @@ class GeekbenchCorproate(Geekbench): | |||||||
|     is_corporate = True |     is_corporate = True | ||||||
|     requires_network = False |     requires_network = False | ||||||
|  |  | ||||||
|     versions = ['4.1.0'] |     versions = ['4.1.0', '5.0.0'] | ||||||
|      |      | ||||||
|     # The activity name for this version doesn't match the package name |  | ||||||
|     activity = 'com.primatelabs.geekbench.HomeActivity'  |     activity = 'com.primatelabs.geekbench.HomeActivity'  | ||||||
|     package = 'com.primatelabs.geekbench4.corporate'  |     package = 'com.primatelabs.geekbench4.corporate'  | ||||||
|  |  | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							| @@ -22,6 +22,7 @@ import android.support.test.runner.AndroidJUnit4; | |||||||
| import android.support.test.uiautomator.UiObject; | import android.support.test.uiautomator.UiObject; | ||||||
| import android.support.test.uiautomator.UiObjectNotFoundException; | import android.support.test.uiautomator.UiObjectNotFoundException; | ||||||
| import android.support.test.uiautomator.UiSelector; | import android.support.test.uiautomator.UiSelector; | ||||||
|  | import android.support.test.uiautomator.UiScrollable; | ||||||
| import android.view.KeyEvent; | import android.view.KeyEvent; | ||||||
|  |  | ||||||
| import com.arm.wa.uiauto.BaseUiAutomation; | import com.arm.wa.uiauto.BaseUiAutomation; | ||||||
| @@ -92,6 +93,7 @@ public class UiAutomation extends BaseUiAutomation { | |||||||
|                     } |                     } | ||||||
|                     break; |                     break; | ||||||
|                 case 4:  |                 case 4:  | ||||||
|  |                 case 5: | ||||||
|                     runCpuBenchmarks(isCorporate); |                     runCpuBenchmarks(isCorporate); | ||||||
|                     waitForResultsv3onwards(); |                     waitForResultsv3onwards(); | ||||||
|                     break; |                     break; | ||||||
| @@ -134,6 +136,7 @@ public class UiAutomation extends BaseUiAutomation { | |||||||
|     public void runCpuBenchmarks(boolean isCorporate) throws Exception { |     public void runCpuBenchmarks(boolean isCorporate) throws Exception { | ||||||
|         // The run button is at the bottom of the view and may be off the screen so swipe to be sure |         // The run button is at the bottom of the view and may be off the screen so swipe to be sure | ||||||
|         uiDeviceSwipe(Direction.DOWN, 50); |         uiDeviceSwipe(Direction.DOWN, 50); | ||||||
|  |         scrollPage(); | ||||||
|  |  | ||||||
|         String packageName = isCorporate ? "com.primatelabs.geekbench4.corporate" |         String packageName = isCorporate ? "com.primatelabs.geekbench4.corporate" | ||||||
|                                          : "com.primatelabs.geekbench"; |                                          : "com.primatelabs.geekbench"; | ||||||
| @@ -184,4 +187,10 @@ public class UiAutomation extends BaseUiAutomation { | |||||||
|         shareButton.waitForExists(WAIT_TIMEOUT_5SEC); |         shareButton.waitForExists(WAIT_TIMEOUT_5SEC); | ||||||
|         shareButton.click(); |         shareButton.click(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public void scrollPage() throws Exception { | ||||||
|  |         UiScrollable listView = new UiScrollable(new UiSelector().className("android.widget.ScrollView")); | ||||||
|  |         listView.setMaxSearchSwipes(3); | ||||||
|  |         listView.scrollTextIntoView("RUN CPU BENCHMARK"); | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user