1 //===- llvm-prof.cpp - Read in and process llvmprof.out data files --------===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This tools is meant for use with the various LLVM profiling instrumentation
11 // passes. It reads in the data file produced by executing an instrumented
12 // program, and outputs a nice report.
14 //===----------------------------------------------------------------------===//
16 #include "ProfileInfo.h"
17 #include "llvm/Bytecode/Reader.h"
18 #include "Support/CommandLine.h"
23 BytecodeFile(cl::Positional, cl::desc("<program bytecode file>"),
27 ProfileDataFile(cl::Positional, cl::desc("<llvmprof.out file>"),
28 cl::Optional, cl::init("llvmprof.out"));
31 int main(int argc, char **argv) {
32 cl::ParseCommandLineOptions(argc, argv, " llvm profile dump decoder\n");
34 // Read in the bytecode file...
35 std::string ErrorMessage;
36 Module *Result = ParseBytecodeFile(BytecodeFile, &ErrorMessage);
38 std::cerr << argv[0] << ": " << BytecodeFile << ": " << ErrorMessage
43 // Read the profiling information
44 ProfileInfo PI(argv[0], ProfileDataFile);