1package com.example.simpleperf.simpleperfexampleofkotlin
2
3import android.support.v7.app.AppCompatActivity
4import android.os.Bundle
5
6class MainActivity : AppCompatActivity() {
7
8    override fun onCreate(savedInstanceState: Bundle?) {
9        super.onCreate(savedInstanceState)
10        setContentView(R.layout.activity_main)
11        createBusyThread()
12    }
13
14    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