@Test public void testRemoveCallsFasterThanNotIncluded() { final CallStackElement callStackElement = TestClass.method0(); callStackElement.removeCallsFasterThan(TimeUnit.MILLISECONDS.toNanos(50)); assertEquals( "----------------------------------------------------------------------\n" + "Selftime (ms) Total (ms) Method signature\n" + "----------------------------------------------------------------------\n" + "000000.00 000% ---------- 001000.00 100% |||||||||| method0\n" + "000000.00 000% ---------- 001000.00 100% |||||||||| `-- method1\n" + "000050.00 005% :--------- 000500.00 050% |||||----- |-- method1_1\n" + "000200.00 020% ||-------- 000200.00 020% ||-------- | |-- method1_1_1\n" + "000200.00 020% ||-------- 000250.00 025% ||:------- | `-- method1_1_2\n" + "000050.00 005% :--------- 000050.00 005% :--------- | `-- method1_1_2_1\n" + "000150.00 015% |:-------- 000500.00 050% |||||----- `-- method1_2\n" + "000050.00 005% :--------- 000050.00 005% :--------- |-- select * from user \n" + "000050.00 005% :--------- 000050.00 005% :--------- |-- select * from address \n" + "000250.00 025% ||:------- 000250.00 025% ||:------- `-- method1_2_1\n", callStackElement.toString()); callStackElement.recycle(); }
@Test public void testRemoveCallsFasterThan() { final CallStackElement callStackElement = TestClass.method0(); callStackElement.removeCallsFasterThan(TimeUnit.MILLISECONDS.toNanos(51)); assertEquals( "----------------------------------------------------------------------\n" + "Selftime (ms) Total (ms) Method signature\n" + "----------------------------------------------------------------------\n" + "000000.00 000% ---------- 001000.00 100% |||||||||| method0\n" + "000000.00 000% ---------- 001000.00 100% |||||||||| `-- method1\n" + "000050.00 005% :--------- 000500.00 050% |||||----- |-- method1_1\n" + "000200.00 020% ||-------- 000200.00 020% ||-------- | |-- method1_1_1\n" + "000250.00 025% ||:------- 000250.00 025% ||:------- | `-- method1_1_2\n" + // method1_1_2_1 is excluded, because execution time 50 < 51 "000150.00 015% |:-------- 000500.00 050% |||||----- `-- method1_2\n" + // io queries are not excluded even though execution time 50 < 51 "000050.00 005% :--------- 000050.00 005% :--------- |-- select * from user \n" + "000050.00 005% :--------- 000050.00 005% :--------- |-- select * from address \n" + "000250.00 025% ||:------- 000250.00 025% ||:------- `-- method1_2_1\n", callStackElement.toString()); callStackElement.recycle(); }
@Test public void testProfiler() { final CallStackElement callStackElement = TestClass.method0(); assertEquals( "----------------------------------------------------------------------\n" + "Selftime (ms) Total (ms) Method signature\n" + "----------------------------------------------------------------------\n" + "000000.00 000% ---------- 001000.00 100% |||||||||| method0\n" + "000000.00 000% ---------- 001000.00 100% |||||||||| `-- method1\n" + "000050.00 005% :--------- 000500.00 050% |||||----- |-- method1_1\n" + "000200.00 020% ||-------- 000200.00 020% ||-------- | |-- method1_1_1\n" + "000200.00 020% ||-------- 000250.00 025% ||:------- | `-- method1_1_2\n" + "000050.00 005% :--------- 000050.00 005% :--------- | `-- method1_1_2_1\n" + "000150.00 015% |:-------- 000500.00 050% |||||----- `-- method1_2\n" + "000050.00 005% :--------- 000050.00 005% :--------- |-- select * from user \n" + "000050.00 005% :--------- 000050.00 005% :--------- |-- select * from address \n" + "000250.00 025% ||:------- 000250.00 025% ||:------- `-- method1_2_1\n", callStackElement.toString()); callStackElement.recycle(); }