Code Monkey home page Code Monkey logo

shell's Introduction

该脚本功能主要是把各个工程所占可执行文件的大小统计出来。

建议clone后放在一个单独的文件下。 中间会产生若干无用的TXT文件,忽略就好。 主要起作用的是这三个脚本:

function.sh: 使用方法:传入一个目(工程所在目录),该脚本会遍历该目录下所有的工程配置文件,把每个工程所引用的类提取出来保存为文件. 该脚本运行过后才能运行ProjectStatistic.sh脚本

calClassSize.sh: 使用方法:传入一个类似linkmap.txt的文件,脚本会把每个类及其占用的size提取出来保存成文件,供统计使用。该linkmap.txt文件需要使用者提供。关于怎么生成这个文件请参考这里。 该脚本运行过后才能运行ProjectStatistic.sh脚本

ProjectStatistic.sh: 使用方法:传入一个文件目录(工程所在目录),会把每个工程所使用的类所占用的size全部输出 该脚本依赖function.sh脚本和calClassSize.sh脚本,前两个脚本执行完毕后才最后执行,否则会找不到文件。

具体里的结果在两个文件里,比如pod有源码的库的size占用在libFinalSizeListSort.txt里,如果第三方的库是以framework形式提供的,则frameworkFinalSizeListSort.txt文件会统计其所占size大小的TXT文件。finalProjectSizeListSort.txt则统计各个工程的大小,看名字就知道已经按照size从大到小排好序了。

执行结果见下图:

备注:

因为Mac操作系统兼容性的问题,不同的系统适用sed或gsed,笔者在最初写脚本的时候,发现gsed可以工作,而sed有一些问题,所以calClassSize.sh的第47行使用的是gsed这个工具,如果在终端执行的过程中有报错,根据错误提示进行处理即可。如果未安装gsed则执行

 brew install gnu-sed

安装即可,如果安装后依然报错,可以试试把gsed替换成sed,测试发现Mac OS X 10.13.5系统需要把gsed替换成sed。

shell's People

Watchers

 avatar  avatar  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.