GithubHelp home page GithubHelp logo

guoxiangcn / cpp_etudes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from satanson/cpp_etudes

0.0 0.0 0.0 13.43 MB

smart tools for source code study : cpptree.pl, calltree.pl, javatree.pl, java_calltree.pl

Shell 0.73% C++ 61.92% Perl 17.90% C 17.82% Makefile 0.01% CMake 1.46% Yacc 0.04% Lex 0.13%

cpp_etudes's Introduction

cpp_etudes

cpp_etudes is a cpp project integrated with google benchmark, google test for validating cpp features and refining vectorized builtin function of databases. It can be built by both clang and gcc. Some interesting perl scripts are also included.

Scripts

calltree.pl: A smart tool to surf C++ source code

run commands to get usage of calltree.pl as follows:

calltree.pl
calltree.pl help
calltree.pl -h
calltree.pl --help

image

csvtable.pl: create a ascii-border table from CSV format.

  1. create a csv file
cat >repeat.csv  <<'DONE'
t,vectorization,new-vectorization,non-vectorization,new speedup,vectorization speedup
repeat/const_times,3112ms, 9797ms, 13986ms(4X memory),3.14,4.49
repeat/const_s, 8107ms, 30231ms, 39501ms(32X memory), 3.72,4.87
repeat,9141ms, 32182ms,44315ms(32X memory), 3.52,4.84
DONE
  1. generate a ascii-border table
cat repeat.csv |./csvtable.pl

+====================+===============+===================+=====================+=============+=======================+
| test               | vectorization | new-vectorization | non-vectorization   | new speedup | vectorization speedup |
+====================+===============+===================+=====================+=============+=======================+
| repeat/const_times | 3112ms        | 9797ms            | 13986ms(4X memory)  | 3.14        | 4.49                  |
| repeat/const_s     | 8107ms        | 30231ms           | 39501ms(32X memory) | 3.72        | 4.87                  |
| repeat             | 9141ms        | 32182ms           | 44315ms(32X memory) | 3.52        | 4.84                  |
+--------------------+---------------+-------------------+---------------------+-------------+-----------------------+

cpptree.pl: show class hierarchy of cpp project in the style of Linux utility tree.

  1. usage, try with incubator-doris, other cpp projects are just ok.
# format

./cpptree.pl <keyword|regex> <filter> <verbose(0|1)> <depth(num)>
- keyword for exact match, regex for fuzzy match;
- subtrees whose leaf nodes does not match filter are pruned, default value is '' means match all;
- verbose=0, no file locations output; otherwise succinctly output;
- depth=num, print max derivation depth.

git clone https://github.com/satanson/incubator-doris.git
cd incubator-doris

# show all classes
./cpptree.pl '\w+'

# show all classes with file locations.
./cpptree.pl '\w+' '' 1

# show all classes exact-match ExecNode if ExecNode class exists
./cpptree.pl 'ExecNode' '' 1

# show all classes fuzzy-match regex '.*Node$' if the literal class name not exists.
./cpptree.pl '.*Node$' '' 1

# show all classes and depth of derivation relationship is less than 3
./cpptree.pl '\w+' '' 1 3

# show all classes whose ancestor class matches 'Node' and itself or its offsprings matches 'Scan'
/cpptree.pl 'Node' 'Scan'

  1. some outputs
cd incubator-doris
./cpptree.pl 'ExecNode'

image

cd ClickHouse
./cpptree.pl IProcessor

image

cd ClickHouse
./cpptree.pl IDataType '' 1

image

cd incubator-doris
./cpptree.pl 'Node' 'Scan'

image

cd ClickHouse
./cpptree.pl IProcessor Aggregat 1

image

color_palette.pl: show color palette for colorful terminal output.

  1. usage
./color_palette.pl

image

cpp_etudes's People

Contributors

satanson avatar bowenxiao1999 avatar cerdore avatar prettykernel avatar qingzhongli 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.