我想要对我的代码进行性能分析以便找出瓶颈。我搜索了一些性能分析工具,但都未能找到符合要求的软件。
过去我经常使用Python,其中有这样一个软件:line_profiler,可以提供以下类型的结果:
过去我经常使用Python,其中有这样一个软件:line_profiler,可以提供以下类型的结果:
0 Line Hits Time Per Hit % Time Line Contents
11 @profile
12 def compute_prior(folder):
13 """
14 Given a folder, we compute the prior of neg and pos
15 folder = "./movie-reviews-en/train/"
16 """
17 # we compute the number of positive reviews
18 3 1719 573.0 52.9 number_positive = len([f for f in listdir(folder + "pos/")])
19 # then the negative
20 3 1512 504.0 46.6 number_negative = len([f for f in listdir(folder + "neg/")])
21 # we add it and we have the total
22 3 6 2.0 0.2 total = number_positive + number_negative
23 # we devide to have the probabilites
24 3 6 2.0 0.2 number_positive /= total
25 3 1 0.3 0.0 number_negative /= total
26 # we return this three numbers
27 3 3 1.0 0.1 return [number_positive, number_negative, total]
Java世界中是否有类似的东西?
感谢您的回复。
附言:我已经知道yourkit、jprofiler、visualwm,但我想要代码内部的东西。