当前位置:网站首页>[rust weekly library] Tokei - a utility for statistics of code lines and other information
[rust weekly library] Tokei - a utility for statistics of code lines and other information
2022-06-30 00:06:00 【51CTO】

Tokei It is a tool to count the number of code lines and other statistical information by language . In fact, this information is very useful , First of all, program apes can use it to estimate the strength of others or observe the growth rate of their own strength ( What a horse , Number theory hero ?). secondly , Managers can use it to estimate the progress and budget of the project ( It is said that a programmer can't write in a day 100 Line code ?). Last , In fact, when looking at the new code, first look at the data , It also helps to understand the code ( Maybe the longest file is where the core logic is ?). therefore , We'll be fine in the future tokei For a second .
All right, no nonsense , First, install it directly cargo Just fine :
Let's take cpython The source code of , look down tokei How to use it
Use it directly tokei+ Directory name can get the number of files classified by language under the directory 、 Lines of code ( Including code and comments ) And the number of blank lines .
$ tokei cpython/
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks
-------------------------------------------------------------------------------
Assembly 6 1978 1723 26 229
Autoconf 13 4493 2708 939 846
Batch 32 2120 1762 7 351
C 317 421274 320386 48459 52429
C Header 384 181963 156295 10240 15428
C Shell 1 25 11 5 9
C++ 5 4223 3241 256 726
CSS 1 6 0 4 2
D 5 83 74 1 8
Fish 1 64 38 13 13
HTML 10 2045 1926 11 108
INI 1 171 102 27 42
JavaScript 2 209 177 14 18
JSON 6 68 68 0 0
Lisp 1 692 502 81 109
Makefile 4 339 242 40 57
Markdown 2 47 47 0 0
Module-Definition 8 1400 1363 14 23
MSBuild 10 995 824 80 91
Objective-C 7 794 635 61 98
PowerShell 6 600 345 171 84
Prolog 1 24 24 0 0
Python 1943 814052 636398 58030 119624
ReStructuredText 645 322625 322625 0 0
Shell 5 797 487 191 119
SVG 8 8 8 0 0
Plain Text 149 89499 89499 0 0
TOML 1 4 4 0 0
VBScript 1 1 0 1 0
Visual Studio Pro| 48 6276 6223 8 45
Visual Studio Sol| 2 1472 1471 0 1
XSL 1 5 5 0 0
XML 58 417 338 7 72
-------------------------------------------------------------------------------
Total 3684 1858769 1549551 118686 190532
-------------------------------------------------------------------------------
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
Use -s You can sort for a column , For example, if we want to sort for the number of lines of code
$ tokei cpython/ -s code
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks
-------------------------------------------------------------------------------
Python 1943 814052 636398 58030 119624
ReStructuredText 645 322625 322625 0 0
C 317 421274 320386 48459 52429
C Header 384 181963 156295 10240 15428
Plain Text 149 89499 89499 0 0
Visual Studio Pro| 48 6276 6223 8 45
C++ 5 4223 3241 256 726
Autoconf 13 4493 2708 939 846
HTML 10 2045 1926 11 108
Batch 32 2120 1762 7 351
Assembly 6 1978 1723 26 229
Visual Studio Sol| 2 1472 1471 0 1
Module-Definition 8 1400 1363 14 23
MSBuild 10 995 824 80 91
Objective-C 7 794 635 61 98
Lisp 1 692 502 81 109
Shell 5 797 487 191 119
PowerShell 6 600 345 171 84
XML 58 417 338 7 72
Makefile 4 339 242 40 57
JavaScript 2 209 177 14 18
INI 1 171 102 27 42
D 5 83 74 1 8
JSON 6 68 68 0 0
Markdown 2 47 47 0 0
Fish 1 64 38 13 13
Prolog 1 24 24 0 0
C Shell 1 25 11 5 9
SVG 8 8 8 0 0
XSL 1 5 5 0 0
TOML 1 4 4 0 0
CSS 1 6 0 4 2
VBScript 1 1 0 1 0
-------------------------------------------------------------------------------
Total 3684 1858769 1549551 118686 190532
-------------------------------------------------------------------------------
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
Use -t You can choose the language you want
$ tokei cpython/ -t=Python
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks
-------------------------------------------------------------------------------
Python 1943 814052 636398 58030 119624
-------------------------------------------------------------------------------
Total 1943 814052 636398 58030 119624
-------------------------------------------------------------------------------
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
You can also select multiple languages at the same time , Use commas to separate
$ tokei cpython/ -t=Python,C++
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks
-------------------------------------------------------------------------------
C++ 5 4223 3241 256 726
Python 1943 814052 636398 58030 119624
-------------------------------------------------------------------------------
Total 1948 818275 639639 58286 120350
-------------------------------------------------------------------------------
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
Use -e You can filter out file name types that you do not want to enter the statistics , For example, we filter out all extension names c The file of
$ tokei cpython/ -e *.c
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks
-------------------------------------------------------------------------------
Assembly 6 1978 1723 26 229
Autoconf 13 4493 2708 939 846
Batch 32 2120 1762 7 351
C Header 384 181963 156295 10240 15428
C Shell 1 25 11 5 9
C++ 5 4223 3241 256 726
CSS 1 6 0 4 2
D 5 83 74 1 8
Fish 1 64 38 13 13
HTML 10 2045 1926 11 108
INI 1 171 102 27 42
JavaScript 2 209 177 14 18
JSON 6 68 68 0 0
Lisp 1 692 502 81 109
Makefile 4 339 242 40 57
Markdown 2 47 47 0 0
Module-Definition 8 1400 1363 14 23
MSBuild 10 995 824 80 91
Objective-C 7 794 635 61 98
PowerShell 6 600 345 171 84
Prolog 1 24 24 0 0
Python 1943 814052 636398 58030 119624
ReStructuredText 645 322625 322625 0 0
Shell 5 797 487 191 119
SVG 8 8 8 0 0
Plain Text 149 89499 89499 0 0
TOML 1 4 4 0 0
VBScript 1 1 0 1 0
Visual Studio Pro| 48 6276 6223 8 45
Visual Studio Sol| 2 1472 1471 0 1
XSL 1 5 5 0 0
XML 58 417 338 7 72
-------------------------------------------------------------------------------
Total 3367 1437495 1229165 70227 138103
-------------------------------------------------------------------------------
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
You can also use --files Make the statistics display by file instead of merging . because cpython Too many files , Let's select a subdirectory to see :
$ tokei cpython/Parser/ --files
-------------------------------------------------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks
-------------------------------------------------------------------------------------------------------------------------
C 9 3860 3158 347 355
-------------------------------------------------------------------------------------------------------------------------
cpython/Parser/listnode.c 70 60 2 8
cpython/Parser/token.c 243 233 3 7
cpython/Parser/myreadline.c 380 295 37 48
cpython/Parser/parsetok.c 495 414 25 56
cpython/Parser/grammar1.c 47 38 3 6
cpython/Parser/parser.c 462 336 61 65
cpython/Parser/acceler.c 123 105 10 8
cpython/Parser/tokenizer.c 1852 1550 163 139
cpython/Parser/node.c 188 127 43 18
-------------------------------------------------------------------------------------------------------------------------
C Header 2 137 101 15 21
-------------------------------------------------------------------------------------------------------------------------
cpython/Parser/parser.h 49 37 2 10
cpython/Parser/tokenizer.h 88 64 13 11
-------------------------------------------------------------------------------------------------------------------------
Python 10 2898 2369 111 418
-------------------------------------------------------------------------------------------------------------------------
cpython/Parser/asdl.py 376 281 41 54
cpython/Parser/asdl_c.py 1417 1224 17 176
cpython/Parser/pgen/automata.py 371 280 20 71
cpython/Parser/pgen/token.py 38 22 4 12
cpython/Parser/pgen/pgen.py 305 255 8 42
cpython/Parser/pgen/metaparser.py 152 115 21 16
cpython/Parser/pgen/__init__.py 0 0 0 0
cpython/Parser/pgen/grammar.py 147 124 0 23
cpython/Parser/pgen/keywordgen.py 59 42 0 17
cpython/Parser/pgen/__main__.py 33 26 0 7
-------------------------------------------------------------------------------------------------------------------------
Total 21 6895 5628 473 794
-------------------------------------------------------------------------------------------------------------------------
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
Finally, you can put these together , such as
$ tokei cpython/Parser/ --files -t=Python -s code -e __init__.py
-------------------------------------------------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks
-------------------------------------------------------------------------------------------------------------------------
Python 9 2898 2369 111 418
-------------------------------------------------------------------------------------------------------------------------
cpython/Parser/asdl_c.py 1417 1224 17 176
cpython/Parser/asdl.py 376 281 41 54
cpython/Parser/pgen/automata.py 371 280 20 71
cpython/Parser/pgen/pgen.py 305 255 8 42
cpython/Parser/pgen/grammar.py 147 124 0 23
cpython/Parser/pgen/metaparser.py 152 115 21 16
cpython/Parser/pgen/keywordgen.py 59 42 0 17
cpython/Parser/pgen/__main__.py 33 26 0 7
cpython/Parser/pgen/token.py 38 22 4 12
-------------------------------------------------------------------------------------------------------------------------
Total 9 2898 2369 111 418
-------------------------------------------------------------------------------------------------------------------------
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
Last , Actually tokei It's a Japanese word , It means clock , Perhaps the author is suggesting that this tool is running very fast . In fact, github And other similar tools (Go Of scc And the same Rust Written loc) Of Compare . But the comparison version is a little old .
Let's run by ourselves to see the current statistics Rust Achievements of the official code base (CPU Time ) Well :
tokei 1.5±0.1s
scc 2.3±1.0s
loc 3.8±0.4s
tokei Isn't it excellent ? But don't take it too seriously , It's all a blink of an eye . Nothing much tokei Check out your code ~
边栏推荐
- Ingenious application of golang generics to prevent null pointer errors of variables and structural fields
- 一步步教你在Edge浏览器上安装网风笔记
- About mongodb error: connecting to: mongodb://127.0.0.1:27017/?compressors=disabled &gssapiServiceName=mongodb
- MySQL multi table query
- @Scheduled注解的坑,我替你踩了
- How about counting Berry Pie 4? What are the possible ways to play?
- Andorid source build/envsetup.sh 该知道的细节
- HTAP x cloud native: tidb accelerates the release of data value and realizes data agility
- Golang6 reflection
- 雲和恩墨蓋國强,識別它、抓住它,在國產數據庫沸騰以前
猜你喜欢

Vulnhub靶机-MoriartyCorp

漫画安全HIDS、EDR、NDR、XDR

Teach you step by step to install webwind notes on edge browser

Applet plug-in access, development and precautions

Exploration and Practice on the future direction of byte cloud database

打造一个 API 快速开发平台,牛逼!

Sword finger offer 15 Number of 1 in binary

基于zfoo开发项目的一些规范

Binary search tree 230 The element with the smallest K in the binary search tree 1038 From binary search tree to larger sum tree

西门子低代码 9.14版本: 满足不同需求
随机推荐
QT learning 05 introduction to QT creator project
西门子低代码 9.14版本: 满足不同需求
手机开户后多久才能通过?另外,手机开户安全么?
After working in the software development industry for six years, I changed my ideas in those years
Leetcode (680) -- verifying palindrome string II
Majority element ii[molar voting method for finding modes]
Analysis of define incdir command in TCL script of Modelsim
How long will it take to open a mobile account? In addition, is it safe to open a mobile account?
AI chief architect 9- huxiaoguang, propeller model library and industry application
项目一:部署 LAMP ecshop电商平台
MySQL:SQL概述及数据库系统介绍 | 黑马程序员
History of deep learning
Which securities company is good for opening a mobile account? In addition, is it safe to open a mobile account?
[LeetCode] 只出现一次的数字【136】
云原生爱好者周刊:炫酷的 Grafana 监控面板集合
ThinkPad VMware installation virtual machine: this host supports Intel VT-x, but Intel VT-x is disabled (problem resolution)
Buffer flow exercise
[leetcode] a number that appears only once [136]
Solr基础操作12
數莓派 4怎麼樣?可能的玩法有哪些?