def METHOD_NAME(file_path, processor):
    result = ""
    throughput = 0
    if processor == "cpu":
        with open(file_path, "r") as f:
            lines = f.readlines()
            for line in lines:
                if "Total img/sec on " in line:
                    result = line + "\n"
                    throughput += float(
                        re.search(r"(CPU\(s\):[ ]*)(?P<throughput>[0-9]+\.?[0-9]+)", line).group(
                            "throughput"
                        )
                    )
    elif processor == "gpu":
        """calculate average throughput"""
        result_list, throughput_list = [], []
        with open(file_path, "r") as f:
            lines = f.readlines()
            for line in lines:
                if "images/sec: " in line:
                    result_list.append(line.strip("\n"))
                    throughput = float(
                        re.search(r"(images/sec:[ ]*)(?P<throughput>[0-9]+\.?[0-9]+)", line).group(
                            "throughput"
                        )
                    )
                    throughput_list.append(throughput)
        result = "\n".join(result_list[-100:]) + "\n"
        if len(throughput_list) == 0:
            raise Exception(
                "Cannot find throughput lines. Looks like SageMaker job was not run successfully. Please check"
            )
        # Take average of last 100 throughput lines
        throughput = sum(throughput_list[-100:]) / len(throughput_list[-100:])
    LOGGER.info(result)
    return result, throughput