platform/core/system/memps.git
3 years agoadjust print style for -s option 19/242619/1
Seung-Woo Kim [Fri, 28 Aug 2020 09:31:55 +0000 (18:31 +0900)]
adjust print style for -s option

Adjust thee whitespace style for "memps -s <pid>".

Change-Id: I8a8899fed613ddb5ebe4828c664452ce94cc3b6e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoAdjust -Werror option 77/242377/2 accepted/tizen/unified/20200831.122448 submit/tizen/20200828.061050
Seungha Son [Wed, 26 Aug 2020 02:01:45 +0000 (11:01 +0900)]
Adjust -Werror option

Change-Id: Ia90be5c9b9b637f632c9c4b0dc9f81ec5be47dc4
Signed-off-by: Seungha Son <seungha.son@samsung.com>
3 years agoBound maximum index for accessing array 52/242252/3 accepted/tizen/unified/20200826.133022 submit/tizen/20200826.010711
Seung-Woo Kim [Tue, 25 Aug 2020 08:08:15 +0000 (17:08 +0900)]
Bound maximum index for accessing array

To avoid too large index to access buffer array, bound maximum
index.

Change-Id: Ifbf973cb4a90d708effce3aae6adc1029fb2850e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoUse proper printing format for struct statfs 77/242277/2
Seung-Woo Kim [Tue, 25 Aug 2020 09:33:15 +0000 (18:33 +0900)]
Use proper printing format for struct statfs

If __USE_FILE_OFFSET64 is defined, struct statfs has 64-bit
elements even in 32-bit arch. Use proper printing format as
the definition.

Change-Id: I42e22ddb9fcab11dad322e56621e444df06e0860
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoUse enough arrary size for snprintf() 76/242276/2
Seung-Woo Kim [Tue, 25 Aug 2020 09:15:09 +0000 (18:15 +0900)]
Use enough arrary size for snprintf()

Use enough arrary size for snprintf() to avoid format-truncation.

Change-Id: I5d51ab3e0f9ba2ac97f7bdb57ff4edc9f5308f1a
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoAlways check return value of fgets() 75/242275/1
Seung-Woo Kim [Tue, 25 Aug 2020 09:08:52 +0000 (18:08 +0900)]
Always check return value of fgets()

Fix to check return value of fgets().

Change-Id: Iaededa3b623dd9e351d56c982939511e075a72e3
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoFix wrong if condition 74/242274/1
Seung-Woo Kim [Tue, 25 Aug 2020 08:59:39 +0000 (17:59 +0900)]
Fix wrong if condition

Fix wrong if condition having both "&&" and "||" without proper
parentheses.

Change-Id: I0eb65cbf10b571331498064098fbda70337b8bc8
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoClear freed pointer to null 41/242241/1
Seung-Woo Kim [Tue, 25 Aug 2020 06:51:38 +0000 (15:51 +0900)]
Clear freed pointer to null

To avoid possible use-after-free, clear frred pointer to null.

Change-Id: I180f96bd2550ee68ff3533745bb033581e247ba9
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoFix not to use uninitialized variable 40/242240/1
Seung-Woo Kim [Tue, 25 Aug 2020 06:43:08 +0000 (15:43 +0900)]
Fix not to use uninitialized variable

From get_mem_info(), buf is used without initialization in error
path. Fix not to use uninitialized variable, buf.

Change-Id: I40934a4ccc6fc6859c0b35f63931d0bb4103d5e9
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years ago[PATCH] Support 3D memory usage value for Mali midgard GPU Driver 30/215630/1 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5 tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191031.022202 accepted/tizen/5.5/unified/mobile/hotfix/20201027.090051 accepted/tizen/5.5/unified/wearable/hotfix/20201027.112740 accepted/tizen/unified/20191014.062508 submit/tizen/20191014.011158 submit/tizen_5.5/20191031.000004 submit/tizen_5.5_mobile_hotfix/20201026.185104 submit/tizen_5.5_wearable_hotfix/20201026.184304 tizen_5.5.m2_release
Minyoung, Song [Tue, 16 Jan 2018 07:09:16 +0000 (16:09 +0900)]
[PATCH] Support 3D memory usage value for Mali midgard GPU Driver

The usage of 3D memory is differ from GPU series
In case of Mali utgard, it comes from smaps of process
In case of Mali midgard, it comes form specific debug node

Change-Id: Iaef54537d107f49763ef8f8508c6787a73851a81
Signed-off-by: Minyoung, Song <minyoung.song@samsung.com>
6 years agoFix Coverity issues 68/153568/1 accepted/tizen_5.0_unified tizen_5.0 accepted/tizen/4.0/unified/20171011.071204 accepted/tizen/5.0/unified/20181102.021012 accepted/tizen/unified/20171019.145735 submit/tizen/20171011.011352 submit/tizen/20171019.073616 submit/tizen_4.0/20171010.054207 submit/tizen_5.0/20181101.000004 tizen_4.0.IoT.p1_release tizen_4.0.m2_release
Sungguk Na [Fri, 29 Sep 2017 01:09:24 +0000 (10:09 +0900)]
Fix Coverity issues

22581 Checked_return
36976 Resource_leak

Change-Id: I983248d1a48d8029f4a8cca2d2eb0997af0410de
Signed-off-by: Sungguk Na <sungguk.na@samsung.com>
6 years agofix build warning 72/152072/1 accepted/tizen/unified/20170929.081742 submit/tizen/20170928.120154
Youngjae Shin [Mon, 25 Sep 2017 04:39:45 +0000 (13:39 +0900)]
fix build warning

Change-Id: I75d689f1fd1bcb5881eb0409a43819f37b3ceda2

6 years agoConsider oom_score_adj in case of non-root permission 69/146969/2 accepted/tizen/4.0/unified/20170908.222139 accepted/tizen/unified/20170908.062310 submit/tizen/20170908.025422 submit/tizen_4.0/20170908.025440
ByungSoo Kim [Wed, 23 Aug 2017 04:24:08 +0000 (13:24 +0900)]
Consider oom_score_adj in case of non-root permission

When memps is executed without root permission,
it can't read oom_score_adj value.
The latest kernel doesn't support reading oom_score_adj value without root.
In case of that, memps should read oom_score value.

Change-Id: Ieb24bfcf7ef065f1230dd7c13698cd52264abe91
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
6 years agoAdapt ASLR to memps 36/143236/1 accepted/tizen/4.0/unified/20170829.020044 accepted/tizen/unified/20170810.172129 submit/tizen/20170810.003256 submit/tizen_4.0/20170828.100004 submit/tizen_4.0/20170828.110004
Sungguk Na [Wed, 9 Aug 2017 07:02:45 +0000 (16:02 +0900)]
Adapt ASLR to memps

Change-Id: I1d0210ec580c1b6e483b70e8eba8ab382e517be2
Signed-off-by: Sungguk Na <sungguk.na@samsung.com>
6 years agoFix freeing null pointer 'glist' 22/132822/1 accepted/tizen/4.0/unified/20170816.011719 accepted/tizen/unified/20170629.085509 submit/tizen/20170619.050706 submit/tizen_4.0/20170811.094300
Hyeongsik Min [Thu, 8 Jun 2017 01:07:50 +0000 (10:07 +0900)]
Fix freeing null pointer 'glist'

WGID : 248006
glist pointer can have null value when memps fails to open gem_info debugfs
node in load_geminfo(). This patch adds null check to prevent freeing
null pointer.

Change-Id: I0a7143ef5405fadfb2e39131ddc5db1f58bea135
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoFix coding style issues detected by rule checker 93/132393/2
Hyeongsik Min [Mon, 5 Jun 2017 01:32:10 +0000 (10:32 +0900)]
Fix coding style issues detected by rule checker

Change-Id: I0b2f6237f733dc300c7fb8c0f223fc08d8cacd07
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
6 years agoUse debugfs node for accessing GEM information 91/132391/1
Hyeongsik Min [Mon, 5 Jun 2017 00:37:11 +0000 (09:37 +0900)]
Use debugfs node for accessing GEM information

drm_proc.c was removed in linux v3.11

Change-Id: I0ff9e92dea03c654ddc0c871f9bd4388ca5afc7b
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoPrevent buffer overflow with sscanf 74/125774/1 accepted/tizen_3.0_common accepted/tizen_3.0_ivi accepted/tizen_3.0_mobile accepted/tizen_3.0_tv accepted/tizen_3.0_wearable tizen_3.0 accepted/tizen/3.0/common/20170510.183012 accepted/tizen/3.0/ivi/20170509.223043 accepted/tizen/3.0/mobile/20170509.223021 accepted/tizen/3.0/tv/20170509.223028 accepted/tizen/3.0/wearable/20170509.223035 accepted/tizen/unified/20170426.195730 submit/tizen/20170426.041441 submit/tizen_3.0-common/20170510.074450 submit/tizen_3.0/20170428.014856 submit/tizen_3.0/20170428.015157 submit/tizen_3.0_common/20170510.075013 tizen_4.0.m1_release
Hyeongsik Min [Tue, 18 Apr 2017 15:11:23 +0000 (00:11 +0900)]
Prevent buffer overflow with sscanf

By allocating string buffer, prevent buffer overlow issue with sscanf.

Change-Id: I5655f1b7049dc457b525dfbc2d351b67616b3f88
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoReplace deprecated readdir_r() with readdir() 73/125773/1
Hyeongsik Min [Tue, 18 Apr 2017 14:54:05 +0000 (23:54 +0900)]
Replace deprecated readdir_r() with readdir()

Change-Id: I88e7060aecfd0cc982fd995f66a30f643b4fd292
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoFix smaps parsing logic 59/116759/2 accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable accepted/tizen/3.0/common/20170302.075821 accepted/tizen/3.0/ivi/20170302.034042 accepted/tizen/3.0/mobile/20170302.033941 accepted/tizen/3.0/tv/20170302.034004 accepted/tizen/3.0/wearable/20170302.034023 accepted/tizen/common/20170228.162222 accepted/tizen/ivi/20170302.120316 accepted/tizen/mobile/20170302.120235 accepted/tizen/tv/20170302.120244 accepted/tizen/unified/20170309.033717 accepted/tizen/wearable/20170302.120303 submit/tizen/20170228.110810 submit/tizen_3.0/20170228.114713 submit/tizen_unified/20170308.100409
Hyeongsik Min [Tue, 28 Feb 2017 06:27:35 +0000 (15:27 +0900)]
Fix smaps parsing logic

Memps fails to parse smaps and gets crash when kernel shows anon name
information in /proc/smaps, because kernel adds additional line to
print the information.
Instead of using fixed smaps line count, this patch checks every line
to find VMA address line.

Change-Id: I5eaad65804f9cae67bfc62b6625b4b7da0eb27aa
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoFix typos 38/115138/1 accepted/tizen/3.0/common/20170220.125755 accepted/tizen/3.0/ivi/20170220.014128 accepted/tizen/3.0/mobile/20170220.014009 accepted/tizen/3.0/tv/20170220.014105 accepted/tizen/3.0/wearable/20170220.014116 accepted/tizen/common/20170216.154900 accepted/tizen/ivi/20170217.022730 accepted/tizen/mobile/20170217.022722 accepted/tizen/tv/20170217.022725 accepted/tizen/wearable/20170217.022728 submit/tizen/20170216.115218 submit/tizen_3.0/20170216.115157 submit/tizen_3.0/20170217.041217
Hyeongsik Min [Thu, 16 Feb 2017 11:17:54 +0000 (20:17 +0900)]
Fix typos

Change-Id: Ibbfd8c2418959d35b890dd53a838d7994ea60333
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoSurpress Svace warning 37/115137/1
Hyeongsik Min [Thu, 16 Feb 2017 10:11:42 +0000 (19:11 +0900)]
Surpress Svace warning

And also change type of rss variable to unsigned long

Change-Id: I2de5440c7ac8eaefc5acafb84244194e435bad14
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoFix fixed value of smaps line count 95/96795/1
Hyeongsik Min [Thu, 10 Nov 2016 07:47:29 +0000 (16:47 +0900)]
Fix fixed value of smaps line count

Vma line was missed, so we need to add 1 on each hardcoded value.

Change-Id: I735bc0aaa312e034655534a78b456a35c5ce9fdb
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoFix build warnings 56/96056/2 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable tizen_3.0.m2 tizen_3.0_tv accepted/tizen/3.0.m2/mobile/20170104.141400 accepted/tizen/3.0.m2/tv/20170104.142007 accepted/tizen/3.0.m2/wearable/20170104.142302 accepted/tizen/3.0/common/20161114.082327 accepted/tizen/3.0/ivi/20161110.021610 accepted/tizen/3.0/mobile/20161110.021512 accepted/tizen/3.0/tv/20161110.021532 accepted/tizen/3.0/wearable/20161110.021547 accepted/tizen/common/20161108.131702 accepted/tizen/ivi/20161109.002349 accepted/tizen/mobile/20161109.002255 accepted/tizen/tv/20161109.002314 accepted/tizen/wearable/20161109.002332 submit/tizen/20161108.023400 submit/tizen_3.0.m2/20170104.093751 submit/tizen_3.0/20161109.042255 submit/tizen_3.0_common/20161110.084657
Hyeongsik Min [Mon, 7 Nov 2016 12:33:41 +0000 (21:33 +0900)]
Fix build warnings

Change-Id: Icf8062b8f35b788a9d58ed2a7d207ef80a98bdaa
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoFix smaps parsing on 64bit kernel 75/95575/1
Hyeongsik Min [Fri, 4 Nov 2016 01:42:18 +0000 (10:42 +0900)]
Fix smaps parsing on 64bit kernel

In previous patch, there is a issue that memps truncates pathname
when it includes blank space.

Change-Id: I72770bc84c4f11b114c2dcdaad69314bacb113e4
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoFix smaps parsing issue on 64bit kernel 90/94490/2
Minyoung, Song [Mon, 31 Oct 2016 07:28:52 +0000 (16:28 +0900)]
Fix smaps parsing issue on 64bit kernel

Signed-off-by: Minyoung, Song <minyoung.song@samsung.com>
Change-Id: Ib1b439805dab0475fce70f1fa41906691fd5790a

7 years agoRefactoring smaps parsing logic 56/93156/2 accepted/tizen/3.0/ivi/20161103.001727 accepted/tizen/3.0/mobile/20161103.001636 accepted/tizen/3.0/tv/20161103.001653 accepted/tizen/3.0/wearable/20161103.001711 accepted/tizen/common/20161027.073329 accepted/tizen/ivi/20161028.151658 accepted/tizen/mobile/20161028.151609 accepted/tizen/tv/20161028.151624 accepted/tizen/wearable/20161028.151637 submit/tizen/20161026.142525 submit/tizen_3.0/20161102.071854
Hyeongsik Min [Thu, 20 Oct 2016 13:20:11 +0000 (22:20 +0900)]
Refactoring smaps parsing logic

To be compatible with various kernel version

Change-Id: Ie494cebc8581612271acb6eb584437563be1017a
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
7 years agoModified kernel version check to support 4.x kernel smaps 62/78662/2 accepted/tizen/3.0/ivi/20161011.055318 accepted/tizen/3.0/mobile/20161015.033623 accepted/tizen/3.0/tv/20161016.005142 accepted/tizen/3.0/wearable/20161015.083525 accepted/tizen/common/20160706.142801 accepted/tizen/ivi/20160706.132921 accepted/tizen/mobile/20160706.132440 accepted/tizen/tv/20160706.132443 accepted/tizen/wearable/20160706.132539 submit/tizen/20160706.112136 submit/tizen_3.0_common/20161104.104000 submit/tizen_3.0_ivi/20161010.000005 submit/tizen_3.0_mobile/20161015.000004 submit/tizen_3.0_tv/20161015.000004 submit/tizen_3.0_wearable/20161015.000004
sungguk [Wed, 6 Jul 2016 10:33:01 +0000 (19:33 +0900)]
Modified kernel version check to support 4.x kernel smaps

Change-Id: I0878424145df4920ef09d4f4b659808ddc26c874
Signed-off-by: sungguk <sungguk.na@samsung.com>
8 years agoBug fix for guaranteeing NULL-termination of strncpy 80/64080/1 accepted/tizen/common/20160428.144412 accepted/tizen/ivi/20160428.081420 accepted/tizen/mobile/20160428.081355 accepted/tizen/tv/20160428.081416 accepted/tizen/wearable/20160428.081406 submit/tizen/20160428.011632
Minyoung, Song [Wed, 30 Mar 2016 02:14:32 +0000 (11:14 +0900)]
Bug fix for guaranteeing NULL-termination of strncpy

Change-Id: I8ef500d9007f0b151fcc5558cc5faab84dbb9d7c
Signed-off-by: Minyoung, Song <minyoung.song@samsung.com>
8 years agoModified licensing header 61/63061/2 accepted/tizen/common/20160322.150723 accepted/tizen/ivi/20160322.090305 accepted/tizen/mobile/20160322.090214 accepted/tizen/tv/20160322.090231 accepted/tizen/wearable/20160322.090248 submit/tizen/20160322.064944
Minyoung, Song [Tue, 22 Mar 2016 03:22:43 +0000 (12:22 +0900)]
Modified licensing header

Signed-off-by: Minyoung, Song <minyoung.song@samsung.com>
Change-Id: I0388c60d0e30aa2fb5a47101a52f268d5f56ccbd

8 years agoFixed gem_info parsing logic to find and sum from all rows of gem_info 28/61828/2 accepted/tizen/common/20160315.220818 accepted/tizen/ivi/20160314.104527 accepted/tizen/mobile/20160314.104434 accepted/tizen/tv/20160314.104452 accepted/tizen/wearable/20160314.104509 submit/tizen/20160314.011535
Minyoung, Song [Fri, 11 Mar 2016 01:26:44 +0000 (10:26 +0900)]
Fixed gem_info parsing logic to find and sum from all rows of gem_info

Signed-off-by: Minyoung, Song <minyoung.song@samsung.com>
Change-Id: Ia4af00cfa8542352d6bc2f9a8b096ccb8e99ce82

8 years agoFix svace issues 28/61628/1
Hyeongsik Min [Wed, 9 Mar 2016 08:29:26 +0000 (17:29 +0900)]
Fix svace issues

Change-Id: I9182ba8d42006a5388dacad9144d9cb2b6a0b2b1
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
8 years agoMerged latest memps code providing swap and cgroup usage 90/61490/3 accepted/tizen/common/20160310.080456 accepted/tizen/ivi/20160310.052756 accepted/tizen/mobile/20160310.052654 accepted/tizen/tv/20160310.052718 accepted/tizen/wearable/20160310.052737 submit/tizen/20160309.011659
Minyoung, Song [Tue, 8 Mar 2016 08:17:17 +0000 (17:17 +0900)]
Merged latest memps code providing swap and cgroup usage

Change-Id: I44624fa22a9bc9f9703c55d919cf1fdf5b9cca42
Signed-off-by: Minyoung, Song <minyoung.song@samsung.com>
8 years agoFix Svace issues 09/55809/1 accepted/tizen/ivi/20160218.023839 accepted/tizen/mobile/20151229.120004 accepted/tizen/tv/20151229.120013 accepted/tizen/wearable/20151229.120020 submit/tizen/20151229.110102 submit/tizen_common/20160218.142243 submit/tizen_ivi/20160217.000000 submit/tizen_ivi/20160217.000003
Hyeongsik Min [Tue, 29 Dec 2015 10:30:27 +0000 (19:30 +0900)]
Fix Svace issues

15723 - DIVISION_BY_ZERO
25769 - DIVISION_BY_ZERO
25770 - DIVISION_BY_ZERO

Change-Id: Icfed0528b6891af56f51c4c7864652ae01801ef8
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
9 years agoInitial code commit 27/36327/4 tizen_3.0.2015.q2_common tizen_3.0.m1_mobile tizen_3.0.m1_tv accepted/tizen/common/20150311.085852 accepted/tizen/mobile/20150312.011935 accepted/tizen/tv/20150312.010542 accepted/tizen/wearable/20150312.011156 submit/tizen/20150311.034641 tizen_3.0.m1_mobile_release tizen_3.0.m1_tv_release tizen_3.0.m2.a1_mobile_release tizen_3.0.m2.a1_tv_release
Prajwal A N [Thu, 5 Mar 2015 07:24:37 +0000 (16:24 +0900)]
Initial code commit

* memps is a tool which provides information about the memory usage of processes (RSS, PSS, memory map of process, clean and dirty pages), tmps and graphics memory usage
* Added source files and CmakeLists file
* Added packaging and license files

Change-Id: I5dc2357ff229ad876ec17919a2e9df51488b89e7
Signed-off-by: Prajwal A N <an.prajwal@samsung.com>
9 years agoInitial empty repository master
KyungMi Lee [Thu, 5 Mar 2015 05:10:39 +0000 (21:10 -0800)]
Initial empty repository