Home | History | Annotate | Download | only in runtest
      1 #include <sys/prctl.h>
      2 
      3 constexpr int LOOP_COUNT = 100000000;
      4 
      5 void Function1() {
      6   for (volatile int i = 0; i < LOOP_COUNT; ++i) {
      7   }
      8 }
      9 
     10 int main() {
     11   // Run the test in an infinite loop, so if we profile the test manually, the process
     12   // doesn't exit before we attach to it. This scheme also allows simpleperf to control
     13   // how long to profile.
     14   while (true) {
     15     prctl(PR_SET_NAME, reinterpret_cast<unsigned long>("RUN_COMM1"), 0, 0, 0); // NOLINT
     16     Function1();
     17     prctl(PR_SET_NAME, reinterpret_cast<unsigned long>("RUN_COMM2"), 0, 0, 0); // NOLINT
     18     Function1();
     19   }
     20   return 0;
     21 }
     22