ITPub博客

首页 > 应用开发 > IT综合 > [20181230]Git Bash启动缓慢.txt

[20181230]Git Bash启动缓慢.txt

原创 IT综合 作者:lfree 时间:2018-12-31 20:00:20 0 删除 编辑

[20181230]Git Bash启动缓慢.txt


--//我在我的机器里安装了git bash,实际上就是在windows下使用git的环境,主要里面的shell很像在linux下使用,

--//最近经常在家里的测试环境使用,不过不知道从什么时候开始启动越来越慢(我大概有1年时间没有使用它),每次启动都以分钟计算。

--//但是第2次启动就快许多,一直没时间探究原因,放假做一个探究看看。


1.启动systeminternals自带的Procmon.exe:

--//加入git bash的命令。

--//在filter 加入 process name=sh.exe

--//接着启动git bash。


2.查看Procmon.exe的输出:

--//截取其中一段:

"19:45:38.8691172","sh.exe","5556","ReadFile","C:\Users\Administrator\AppData\Local\Temp","SUCCESS","Offset: 3,014,656, Length: 4,096, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal","3428"

"19:45:38.9018613","sh.exe","5556","ReadFile","C:\Users\Administrator\AppData\Local\Temp","SUCCESS","Offset: 942,080, Length: 4,096, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal","3428"

"19:45:38.9188716","sh.exe","5556","QueryDirectory","C:\Users\Administrator\AppData\Local\Temp","SUCCESS","0: {D59E17DB-AF30-486c-B0D3-FFFE5A543C08}, 1: {D5A1B416-49D9-4a8c-B1B9-44A91154741C}.tmp, 2: {D5A582E2-E7F7-4c65-AFEA-BB4984279266}.tmp, 3: {D5B0B300-B036-4358-807D-F676DD3C5FF4}, 4: {D5B6BA25-B8E7-4c49-877F-447B1C84E836}.tmp, 5: {D5C758E6-89AB-4b27-A6A9-F865F19D29D3}.tmp, 6: {D5CD3CD7-CB6F-4017-8C59-19CBAC3DB2B3}, 7: {D5EF4169-E8AD-435E-B62C-25F9B68C409E}, 8: {D5FD8CB5-D0AA-48e1-AA6B-5310413FF689}.tmp, 9: {D600C6E9-992D-4a3c-8EC4-F713BAA68D60}, 10: {D60F47D2-B682-4b42-82D5-60256C15A59B}, 11: {D6169450-79D0-4b70-BE3B-70041F93F847}.tmp, 12: {D6332DE0-4DAD-4bc0-80C3-ED4D3274084E}, 13: {D652BF56-F74D-4000-A925-6D0F1B18FB44}.tmp, 14: {D66C0A42-D81A-40cc-BF29-06D653F691D2}.tmp, 15: {D69B75A6-4970-44f8-BBE2-6370A712A405}, 16: {D6A0D8AA-E57D-4679-8E32-E1FBD4830EC6}, 17: {D6AE0700-69C8-47f2-8068-784F0516EE0D}, 18: {D6C3FA25-8CD8-4b74-B8E6-BE7F9BDB1358}.tmp, 19: {D6C90D9C-D706-49e6-9DBF-40DEB6F59E1B}, 20: {D6CA449E-4AF4-4ef9-A74C-D61E55F00A66}.tmp, 21: {D6D74BD6-A680-4980-8481-8A4E82CAE27F}.tmp","3428"

"19:45:38.9398716","sh.exe","5556","ReadFile","C:\Users\Administrator\AppData\Local\Temp","SUCCESS","Offset: 4,251,648, Length: 4,096, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal","3428"

"19:45:39.0587826","sh.exe","5556","ReadFile","C:\Users\Administrator\AppData\Local\Temp","SUCCESS","Offset: 2,220,032, Length: 4,096, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal","3428"

"19:45:39.0988808","sh.exe","5556","ReadFile","C:\Users\Administrator\AppData\Local\Temp","SUCCESS","Offset: 3,858,432, Length: 4,096, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal","3428"

"19:45:39.1216568","sh.exe","5556","QueryDirectory","C:\Users\Administrator\AppData\Local\Temp","SUCCESS","0: {D6DEC424-ECE4-441d-9AD5-4D57ED4FD231}.tmp, 1: {D6DED546-747B-4372-B68D-44BC22F7272E}.tmp, 2: {D6E12931-CECF-40b0-AD36-000D51F10C18}, 3: {D6E998CD-A6F9-4bd8-9F8B-69BB8D505081}, 4: {D6EA89B9-F6D1-4d53-AB41-7D6C5FB372D5}, 5: {D72D111D-55F4-46c9-A7E1-93DE7CE5A5F7}, 6: {D757364B-68E5-4b40-97A6-F195DCFB767F}, 7: {D761B700-23E9-4d1c-9C3E-C5DADBCC93ED}.tmp, 8: {D773C39B-D88C-472d-BB2E-AF8FBD1394C2}.tmp, 9: {D787365F-B1FC-428c-9729-F495D1B7F15A}.tmp, 10: {D787A5DF-CA22-4a15-87F5-F78D1093F262}, 11: {D792667A-E1F4-4687-B7A9-C21E4BB96BA7}.tmp, 12: {D797E205-C262-4161-A3F2-40F17147A694}, 13: {D7A2B64D-44C0-419a-B618-164985997650}, 14: {D7B3B8DB-7448-48b0-9075-D63160DC6CBB}, 15: {D7B3DCAA-B416-4618-9A33-F23B433E9901}, 16: {D7C7F0F0-310B-48c2-9494-5C9918F2CFC7}.tmp, 17: {D7C829B9-425B-4a93-909E-4A6AF7489A6D}, 18: {D7E10170-28A8-410c-86CD-9AA67CB201D2}.tmp, 19: {D7E9B7B8-EC3E-4209-B11D-44BB505F4A6D}, 20: {D8001ABD-7C77-4714-B8A9-DBEBBB992152}, 21: {D839B58E-56EF-4dec-82C6-BEBDE54C0543}","3428"

"19:45:39.1608374","sh.exe","5556","ReadFile","C:\Users\Administrator\AppData\Local\Temp","SUCCESS","Offset: 1,380,352, Length: 4,096, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal","3428"

"19:45:39.2271118","sh.exe","5556","ReadFile","C:\Users\Administrator\AppData\Local\Temp","SUCCESS","Offset: 2,285,568, Length: 4,096, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal","3428"

"19:45:39.2287863","sh.exe","5556","QueryDirectory","C:\Users\Administrator\AppData\Local\Temp","SUCCESS","0: {D841B214-9CBC-45e2-BE05-9FBBDB43B1CF}, 1: {D843F502-9E60-4862-B232-9E90B6C8D3B9}.tmp, 2: {D844F2F3-84D0-492e-9466-921F0B3F6DDA}.tmp, 3: {D857F1E6-0D8C-4a93-87C7-A6A3E4C16528}.tmp, 4: {D87BB503-DDF6-44db-B95D-2A8CC8642B71}, 5: {D8924AC5-EA32-400a-98FD-465D88875340}, 6: {D8A51EB1-8470-4d11-9772-9DA46928F60B}, 7: {D8B0E597-6785-4555-A2F3-8E1EF15868E9}.tmp, 8: {D8BFB95F-91B2-43e5-A55F-2B96B54FE4B1}.tmp, 9: {D8D2641C-6A29-4225-ACF0-F2DE49657A61}.tmp, 10: {D8D84C50-C065-43f1-93BC-0BF881745CB6}, 11: {D8EA527F-AFB0-4139-AC98-EB362C21CCD5}, 12: {D8EE99C1-7FBD-4a0c-B24A-C8C07B4F566C}, 13: {D909AD82-6C93-4a2d-8120-9B2133D631E7}, 14: {D9337CDA-1961-4dbd-8371-6AD766BB71ED}, 15: {D93EAC2C-D811-45e5-BA6E-8936B68139F0}.tmp, 16: {D95AE73B-52D9-4259-9D51-4DF90E50B31A}, 17: {D976BB0E-9E12-48f9-AD83-DA256A3840F7}.tmp, 18: {D978BBCD-94B5-4e58-97C5-FDD25251AE53}, 19: {D991073C-BD72-48e1-ABB6-8D4F25B23F04}, 20: {D99C00A1-BFB3-4566-AB4A-3C7C7B9D73AA}, 21: {D9AAF2A4-47FD-4ee7-BCB7-B6BF6125FE98}","3428"

"19:45:39.3042872","sh.exe","5556","ReadFile","C:\Users\Administrator\AppData\Local\Temp","SUCCESS","Offset: 1,708,032, Length: 4,096, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal","3428"

"19:45:39.3483337","sh.exe","5556","ReadFile","C:\Users\Administrator\AppData\Local\Temp","SUCCESS","Offset: 3,293,184, Length: 4,096, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal","3428"


--//原来不断读取C:\Users\Administrator\AppData\Local\Temp目录的内容.从读偏移可以看出目录很大,每次仅仅读取4096.

--//而且不是按照顺序读取,很明显该目录里面的文件垃圾太多.


C:\Users\Administrator\AppData\Local\Temp>dir *.*|wc

  13453   53918  855600


--//^_^,13XXX个文件以及目录.在删除前我看了一些文件的内容,估计都是程序异常退出留下的垃圾.

--//我个人一直认为windows不是什么好的操作系统.


d:\>set | grep -i temp

TEMP=C:\Users\ADMINI~1\AppData\Local\Temp

TMP=C:\Users\ADMINI~1\AppData\Local\Temp


D:\>cd C:\Users\Administrator\AppData\Local\Temp

D:\>C:

C:\Users\Administrator\AppData\Local\Temp> rm -rf *

--//小心^_^.打入前仔细检查目录是否正常.


rm: baidu\baiduyunguanjia\at_20181230_1: Permission denied

....

rm: nso3e2a.tmp: Directory not empty

rm: nsy3E19.tmp: Permission denied

rm: Procmon64.exe: Permission denied

rm: ~DFCEABA9338A926B9A.TMP: Permission denied

--//一些文件还不能清除,估计当前在使用它.看来以后要养成定期清除该目录的好习惯.


3.再重新启动机器,点击git bash,马上进入,问题解决.真不知道为什么git bash启动为什么要扫描该临时目录.

--//我最后修改环境变量,将它指向D:\temp.还有一种方法就是写一个批处理,单独使用某个临时文件夹.例如:

$ cat sh.bat

@echo off

set TEMP=D:\temp

set TMP=D:\temp

D:\tools\git\bin\sh.exe --login -i


--//建立快捷方式,这样启动也很快.而且要注意定期清理该目录.


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2287069/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    2854
  • 访问量
    6642511