1 package com.example.simpleperf.simpleperfexampleofkotlin 2 3 import android.support.v7.app.AppCompatActivity 4 import android.os.Bundle 5 6 class MainActivity : AppCompatActivity() { 7 onCreatenull8 override fun onCreate(savedInstanceState: Bundle?) { 9 super.onCreate(savedInstanceState) 10 setContentView(R.layout.activity_main) 11 createBusyThread() 12 } 13 createBusyThreadnull14 fun createBusyThread() { 15 object : Thread() { 16 var i = 0 17 18 override fun run() { 19 while (true) { 20 i = callFunction(i) 21 } 22 } 23 24 fun callFunction(i: Int): Int { 25 return i + 1 26 } 27 }.start() 28 } 29 } 30