• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdio.h>
2 #include <stdlib.h>
3 
4 #include "cpu-features.h"
5 
panic(const char * msg)6 static void panic(const char* msg) {
7   fprintf(stderr, "ERROR: %s\n", msg);
8   exit(1);
9 }
10 
main(void)11 int main(void) {
12   int count, cpu_count = 10;
13   uint64_t features, cpu_features = 0xaabdedf012934839ULL;
14 
15   count = android_getCpuCount();
16   features = android_getCpuFeatures();
17 
18   printf("Retrieved cpu_count=%d, features=%08llx\n",
19          count, features);
20 
21   // Check that android_setCpu() will fail when it is called after
22   // android_getCpuCount / android_getCpuFeatures.
23   //
24   printf("Trying to set cpu_count=%d, features=%08llx\n",
25          cpu_count,
26          cpu_features);
27 
28   if (android_setCpu(cpu_count, cpu_features))
29     panic("android_setCpu() call should have failed!");
30 
31   printf("android_setCpu() call fail as expected.\n");
32   return 0;
33 }
34