def get_hotspots(n=1000):
    file_line_samples = {}
    file_module_map = _make_file_module_name_map()
    ctx = context.get_context()
    total = 0
    if ctx.sampling:
        for key, count in ctx.profiler.live_data_copy().items():
            if key[2] is not None:
                continue  # only interested in leaf samples
            fname = key[0].co_filename
            name = file_module_map.get(fname, fname)
            file_line_samples[(name, key[1])] = count
            total += count
    vals = sorted(
        file_line_samples.items(), key=lambda v: v[1], reverse=True)[:n]
    vals = [(line_info, "{0:.2f}".format(samples * 100.0 / total))
            for line_info, samples in vals]
    return clastic.Response(
        '\n'.join([repr(e) for e in vals]), mimetype="text/plain")
dataset/ETHPy150Open paypal/support/support/meta_service/codeview.py/get_hotspots/original