def METHOD_NAME(self):
    smg = SoftwareManager()
    dist = distro.detect()
    if dist.name in ['Ubuntu']:
        linux_tools = "linux-tools-" + os.uname()[2]
        pkgs = [linux_tools]
        if dist.name in ['Ubuntu']:
            pkgs.extend(['linux-tools-common'])
    elif dist.name in ['debian']:
        pkgs = ['linux-perf']
    elif dist.name in ['centos', 'fedora', 'rhel', 'SuSE']:
        pkgs = ['perf']
    else:
        self.cancel("perf is not supported on %s" % dist.name)
    self.temp_file = tempfile.NamedTemporaryFile().name
    dmesg.clear_dmesg()
    for pkg in pkgs:
        if not smg.check_installed(pkg) and not smg.install(pkg):
            self.cancel(
                "Package %s is missing/could not be installed" % pkg)