Git Product home page Git Product logo

cpp-profiler's Introduction

CS23001 Project 4

Milestone 1 - 30 pts

Implementation [6/6]

  • [X] Name the folder for this project profiler.
  • [X] Read the code in ASTree.hpp/cpp, profile.hpp/cpp, and main.cpp.
  • [X] The provided code works (compiles and runs) and the read/write are implemented.
  • [X] Implement AST methods: [4/4]
    • [X] TESTED WORKING destructor
      • I used shared pointers and tested for memory leaks with valgrind.
    • [X] TESTED WORKING copy constructor
    • [X] TESTED WORKING constant time swap
    • [X] TESTED WORKING assignment operator
  • [X] Manually check the above using the function in main.cpp.
  • [X] Use the provided makefile.

Milestone 2 - 30 pts

Implementation [2/5]

  • [X] Read the code in ASTree.hpp/cpp.
  • [ ] Read and use the provided profile ADT profile.hpp/cpp. This is a simple ADT that uses the STL map data type. It is a map of (string X int). With the string being the function name and/or line number. The integer is the count of times that line/function is executed.
  • [ ] To profile the program you will need to create a profile object for each file (as given on the command line) to keep track of statements and functions. These will be inserted as code into the main as global variable declarations. The main is the first file given in the input.
  • [ ] All profile objects need to be declared in the main and for each additional file you will need to #include "profile.hpp"; and declare the file’s profile object as external, for example extern foo_cpp;
    • The profiler only needs to work on cpp files. Do not instrument header files (.h, .hpp).
  • [X] TESTED WORKING Implement the functionality to insert profile declarations into the main file. This is needed for milestone 3. For example given the following main:
    • Input:
      // main1.cpp
      #include <iostream>
      
      int main() {
           int i;
           i = 0;
           while (i < 10) {
               ++i;
               std::cout << i;
           }
           return 0;
      }
              
    • Output:
      // p-main1.cpp
      #include <iostream>
      
      #include "profile.hpp"
      profile main1_cpp("main1.cpp");
      
      int main() {
           int i;
           i = 0;
           while (i < 10) {
               ++i;
               std::cout << i;
           }
           return 0;
      }
              

Testing:

  • [ ] Use simple.cpp (simple.cpp.xml) as a test case.
  • [X] Make sure insertion of the code works properly (manually inspect).
  • [ ] The output (p-simple.cpp) should compile and run.

TODOs [2/4]

  • [X] Refactor “monolithic test”, possibly by creating a function profile(std::vector<std::string> inputs).
  • [X] Modernize the file-handling code with std::filesystem::path instead of find and replace, which didn’t handle subdirectories properly.
  • [ ] Test that AST::swap executes in constant time.
  • [ ] Add a pre-commit hook to run tests against the index.

cpp-profiler's People

Contributors

jmaletic avatar zaz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.