I am trying to monitor a process on android using top command
adb shell top -b -n 10 -d 1 -H -p 20493
CPU usage of some threads is negative. The following is part of info I get. The negative CPU usage is at the end.
21468 u0_a245 20 0 22G 536M 342M S -1.0 7.2 0:00.04 V8 DefaultWorke com.tencent.mm
21467 u0_a245 20 0 22G 536M 342M S -1.0 7.2 0:00.05 V8 DefaultWorke com.tencent.mm
20836 u0_a245 10 -10 22G 536M 342M S -2.0 7.2 0:00.02 mali-compiler com.tencent.mm
20728 u0_a245 20 0 22G 536M 342M S -2.0 7.2 0:00.02 binder:20493_4 com.tencent.mm
20604 u0_a245 20 0 22G 536M 342M S -3.0 7.2 0:00.25 [GT]ColdPool#10 com.tencent.mm
21735 u0_a245 20 0 22G 536M 342M S -4.0 7.2 0:00.04 mars::21735 com.tencent.mm
20599 u0_a245 20 0 22G 536M 342M S -4.0 7.2 0:00.23 [GT]ColdPool#6 com.tencent.mm
21732 u0_a245 20 0 22G 536M 342M S -5.0 7.2 0:00.05 mars::21732 com.tencent.mm
21888 u0_a245 12 -8 22G 536M 342M S -6.0 7.2 0:00.13 mars::21888 com.tencent.mm
20596 u0_a245 30 10 22G 536M 342M S -6.0 7.2 0:00.33 [GT]ColdPool#3 com.tencent.mm
20749 u0_a245 20 0 22G 536M 342M S -8.0 7.2 0:00.08 LogcatCatcher com.tencent.mm
20719 u0_a245 16 -4 22G 536M 342M S -12.0 7.2 0:00.39 [GT]HotPool#2 com.tencent.mm
20621 u0_a245 16 -4 22G 536M 342M S -15.0 7.2 0:00.15 [GT]HotPool#1 com.tencent.mm
20597 u0_a245 20 0 22G 536M 342M S -16.0 7.2 0:00.27 [GT]ColdPool#4 com.tencent.mm
20733 u0_a245 16 -4 22G 536M 342M S -20.0 7.2 0:00.20 [GT]HotPool#5 com.tencent.mm
20747 u0_a245 20 0 22G 536M 342M S -21.0 7.2 0:00.29 SearchDaemon com.tencent.mm
20732 u0_a245 16 -4 22G 536M 342M S -22.0 7.2 0:00.42 [GT]HotPool#4 com.tencent.mm
21319 u0_a245 20 0 22G 536M 342M S -23.0 7.2 0:00.63 binder:20493_7 com.tencent.mm
20724 u0_a245 16 -4 22G 536M 342M S -25.0 7.2 0:00.27 [GT]HotPool#3 com.tencent.mm
20619 u0_a245 20 0 22G 536M 342M S -25.0 7.2 0:00.37 [GT]ColdPool#14 com.tencent.mm
21474 u0_a245 20 0 22G 536M 342M S -26.0 7.2 0:00.26 JSBizLogicJsEng com.tencent.mm
20606 u0_a245 20 0 22G 536M 342M S -29.0 7.2 0:00.29 [GT]ColdPool#12 com.tencent.mm
21464 u0_a245 20 0 22G 536M 342M S -36.0 7.2 0:00.40 JSWebPrefetcher com.tencent.mm
20742 u0_a245 16 -4 22G 536M 342M S -42.0 7.2 0:00.42 [GT]HotPool#7 com.tencent.mm
20736 u0_a245 16 -4 22G 536M 342M S -43.0 7.2 0:00.43 [GT]HotPool#6 com.tencent.mm
21049 u0_a245 20 0 22G 536M 342M S -59.0 7.2 0:00.59 binder:20493_5 com.tencent.mm
20593 u0_a245 20 0 22G 536M 342M S -107.0 7.2 0:01.40 binder:20493_3 com.tencent.mm
20612 u0_a245 12 -8 22G 536M 342M S -147.0 7.2 0:01.47 mars::20612 com.tencent.mm
20610 u0_a245 12 -8 22G 536M 342M S -383.0 7.2 0:03.83 mars::20610 com.tencent.mm
Is is normal? How should I deal with these negative value? Set to zero or take the absolute value of them?
I have tried to google the reason, but this problem seems rarely seen.
Related
I'm trying to create a shadow with these specific properties:
Blur , Y offset , color. (specified by the customer, using Zeplin to generate layout designs: link )
But I can't do this with "elevation" property only.
the only place I found these attributes at was by creating a 9-patch image using this website:
http://inloop.github.io/shadow4android
but the problem with it that it resizes my xml element(cardview,button...)
is there any other way to create shadows in Android?
You can convert png image to SVG.
Then you can convert that SVG to vector drawable in android.(you can use below mentioned online converter)
http://a-student.github.io/SvgToVectorDrawableConverter.Web/
relevant drawable for your example image is shown below. (it is a little bit different) you can do your own by following the above steps.
**But there are some limitations and please provide png which can be convertible to svg properly.
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="234"
android:viewportHeight="234"
android:width="292.5dp"
android:height="292.5dp">
<group
android:scaleX="0.1"
android:scaleY="-0.1"
android:translateY="234">
<path
android:pathData="M256 2252c-11 -9 -16 -12 -12 -5 4 7 -1 9 -14 6 -11 -3 -18 -8 -16 -12 2 -3 -7 -11 -20 -18 -13 -6 -22 -7 -18 -2 3 5 1 9 -4 9 -5 0 -12 -9 -15 -21 -4 -13 -10 -18 -18 -13 -8 4 -10 3 -5 -4 4 -8 0 -12 -11 -12 -11 0 -14 -3 -7 -8 7 -5 7 -14 -1 -29 -7 -13 -14 -20 -17 -18 -3 3 -8 -3 -11 -15 -3 -13 -1 -18 6 -13 7 3 4 -3 -7 -15 -15 -18 -16 -24 -6 -37 7 -8 9 -15 4 -15 -5 0 -9 -379 -9 -864 0 -492 4 -862 9 -859 5 3 4 -3 -2 -13 -8 -15 -7 -24 6 -38 9 -11 12 -16 5 -13 -7 5 -9 0 -6 -13 3 -12 8 -18 11 -15 3 2 10 -5 17 -18 8 -15 8 -24 1 -29 -7 -5 -4 -8 7 -8 11 0 15 -4 11 -12 -5 -7 -3 -8 5 -4 8 5 14 0 18 -13 3 -12 10 -21 15 -21 5 0 7 4 4 9 -4 5 5 4 18 -2 13 -7 22 -15 20 -18 -2 -4 5 -9 16 -12 13 -3 18 -1 13 6 -3 7 3 4 14 -6 14 -12 23 -15 28 -8 3 6 11 11 16 11 6 0 8 -3 6 -7 -3 -5 386 -8 863 -8 477 0 866 3 863 8 -2 4 0 7 6 7 5 0 13 -5 16 -11 5 -7 14 -4 28 8 11 10 17 13 14 6 -5 -7 0 -9 13 -6 11 3 18 8 16 12 -2 3 7 11 20 18 13 6 22 7 18 2 -3 -5 -1 -9 4 -9 5 0 12 9 15 21 4 13 10 18 18 13 8 -4 10 -3 5 4 -4 8 0 12 11 12 11 0 14 3 7 8 -7 5 -7 14 1 29 7 13 14 20 17 18 3 -3 8 3 11 15 3 13 1 18 -6 13 -7 -3 -4 2 5 13 13 14 14 23 6 38 -6 10 -7 16 -2 13 5 -3 9 366 9 858 0 475 -3 861 -7 858 -12 -7 -9 12 4 25 9 9 7 17 -8 33 -10 13 -14 19 -7 16 7 -5 9 0 6 13 -3 12 -8 18 -11 15 -3 -2 -10 5 -17 18 -8 15 -8 24 -1 29 7 5 4 8 -7 8 -11 0 -15 4 -11 12 5 7 3 8 -5 4 -8 -5 -14 0 -18 13 -3 12 -10 21 -15 21 -5 0 -7 -4 -4 -9 4 -5 -5 -4 -18 2 -13 7 -22 15 -20 18 2 4 -5 9 -16 12 -13 3 -18 1 -13 -6 3 -7 -3 -4 -14 6 -14 12 -23 15 -28 8 -3 -6 -11 -11 -16 -11 -6 0 -8 3 -6 8 3 4 -386 7 -863 7 -477 0 -866 -3 -863 -7 6 -12 -11 -10 -23 2 -7 7 -16 4 -28 -8zm1867 -106c15 -10 31 -30 35 -45 9 -34 9 -1828 0 -1862 -4 -15 -20 -35 -35 -45 -27 -18 -65 -19 -949 -19 -740 0 -926 3 -945 13 -57 30 -54 -16 -57 937 -2 484 0 904 3 934 8 62 38 97 88 104 18 2 437 4 932 3 862 -1 901 -2 928 -20z"
android:fillColor="#000000" />
<path
android:pathData="M2335 1165c0 -556 1 -784 2 -508 2 276 2 730 0 1010 -1 279 -2 54 -2 -502z"
android:fillColor="#000000" />
<path
android:pathData="M667 3C944 1 1396 1 1672 3 1949 4 1723 5 1170 5 617 5 391 4 667 3Z"
android:fillColor="#000000" />
</group>
</vector>
I converted the png file to SVG and got it from http://inloop.github.io/svg2android/ to find the vector path information.
I have been trying to support from api level 21 to get the right resolution for all screen sizes by using vector drawables. (My app`s minSdk is 21)
The problem is that the text is white and the background color is transparent, but I am trying to change it using the fillColor attribute or strokeColor, but somehow not working well.
how do I achieve this? I want text`s color is white and other background is transparent.
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="386.000000dp"
android:height="149.000000dp"
android:viewportWidth="386.000000"
android:viewportHeight="149.000000"
>
<group
android:translateY="149.000000"
android:scaleX="0.100000"
android:scaleY="-0.100000"
>
<path
android:strokeColor="#FFFFFF"
android:strokeWidth="3"
android:pathData="M0 745 l0 -745 1930 0 1930 0 0 432 0 432 -45 -72 c-85 -138 -151 -202 -209 -202 -65 0 -85 40 -87 175 -2 140 -18 161 -77 97 -46 -50 -153 -224 -155 -252 -1 -18 -7 -20 -37 -18 l-35 3 2 80 c2 44 5 91 9 105 5 24 5 23 -17 -5 -44 -60 -135 -147 -171 -166 -49 -25 -112 -25 -138 1 -29 29 -33 61 -17 138 l14 70 -60 -44 c-32 -24 -63 -44 -68 -44 -5 0 -6 -19 -3 -42 11 -86 -57 -158 -148 -158 -39 0 -54 5 -73 25 -14 13 -25 31 -25 39 0 24 48 74 100 103 l48 27 -31 57 -31 56 -54 -44 c-30 -25 -65 -50 -78 -55 -20 -10 -23 -16 -18 -52 10 -84 -58 -156 -148 -156 -39 0 -54 5 -73 25 -14 13 -25 31 -25 39 0 24 48 74 100 103 l49 27 -26 46 -26 46 -81 -81 c-99 -100 -170 -138 -266 -143 -55 -3 -70 0 -100 20 -96 65 -67 247 51 325 33 22 56 28 110 31 63 4 70 2 95 -23 22 -22 25 -32 21 -62 -11 -64 -79 -113 -184 -134 -70 -13 -79 -28 -44 -70 16 -20 28 -24 68 -23 67 1 142 43 229 129 59 59 72 78 78 114 7 48 52 101 84 101 27 0 55 -34 48 -58 -4 -10 -17 -29 -31 -42 l-24 -23 32 -58 c18 -32 34 -59 37 -59 3 0 36 23 73 51 55 40 73 61 92 104 35 79 83 106 119 66 21 -23 15 -49 -19 -81 l-25 -23 32 -56 c17 -31 33 -58 34 -60 2 -2 33 18 69 43 67 48 101 88 91 104 -7 11 60 26 74 17 15 -9 12 -70 -7 -163 -16 -75 -16 -83 -1 -98 21 -21 45 -13 106 35 64 51 160 179 158 211 -1 18 6 27 25 34 15 5 35 6 44 2 16 -6 17 -16 11 -99 l-7 -92 49 75 c65 101 114 142 166 138 62 -5 77 -33 83 -164 5 -106 14 -144 33 -144 20 0 78 62 130 139 47 69 58 80 78 76 l22 -5 0 310 0 310 -1930 0 -1930 0 0 -745z m499 358 c-30 -38 -44 -42 -145 -43 l-101 0 -12 -62 c-7 -35 -15 -74 -18 -87 l-6 -24 79 6 c44 3 88 9 97 13 23 8 21 -8 -4 -40 -19 -24 -26 -26 -99 -26 l-79 0 -12 -57 c-20 -98 -18 -115 16 -132 24 -12 42 -12 100 -3 38 6 80 14 93 18 13 4 22 2 22 -4 0 -6 -10 -22 -22 -36 -26 -29 -94 -46 -189 -46 -122 0 -138 23 -111 163 l19 98 -23 -5 c-12 -3 -30 -9 -40 -13 -17 -6 -16 -4 2 28 13 22 29 35 46 37 23 3 27 10 38 65 6 34 14 73 17 86 5 22 4 23 -28 16 -19 -4 -47 -14 -62 -22 -16 -8 -31 -12 -34 -10 -6 7 24 64 39 74 7 4 90 11 183 14 94 3 187 6 209 7 35 2 37 1 25 -15z m2587 -21 c-18 -34 -91 -92 -117 -92 -40 0 -31 56 10 65 15 3 47 19 71 35 24 16 46 28 48 26 2 -2 -3 -18 -12 -34z m-2037 -47 c25 3 57 9 70 12 23 6 24 5 17 -42 -4 -26 -10 -54 -13 -62 -4 -10 6 -8 36 8 51 26 129 23 162 -7 98 -87 40 -283 -101 -342 -22 -9 -57 -13 -101 -10 l-67 4 -17 -84 c-9 -46 -15 -98 -13 -115 3 -31 2 -32 -37 -32 -39 0 -40 1 -43 35 -2 20 11 100 28 179 16 79 30 147 30 150 0 3 -14 -11 -31 -32 -86 -104 -211 -116 -282 -26 l-24 31 -25 -44 c-14 -23 -31 -61 -39 -83 -7 -22 -17 -44 -21 -49 -11 -14 -48 24 -48 49 0 23 67 132 95 155 13 10 12 17 -4 48 -10 21 -27 63 -37 96 l-18 58 23 19 c34 27 61 25 61 -6 0 -31 39 -135 50 -135 15 0 61 67 75 107 10 30 19 39 40 41 63 8 50 -45 -35 -141 -28 -30 -50 -59 -50 -64 0 -5 10 -19 23 -30 60 -55 102 -53 172 9 60 53 100 113 109 163 4 22 9 48 12 58 4 14 -1 17 -35 17 -37 0 -71 19 -71 40 0 5 -3 15 -6 24 -5 13 0 13 32 5 20 -6 58 -8 83 -4z m769 -95 c2 -17 -6 -34 -22 -49 -25 -23 -27 -24 -45 -7 -18 16 -21 16 -50 1 -44 -22 -115 -116 -162 -212 -37 -76 -43 -83 -70 -83 -18 0 -32 6 -36 16 -3 8 4 65 17 126 12 61 22 132 23 157 1 25 6 49 12 53 17 13 65 9 71 -6 3 -8 -1 -50 -9 -93 -8 -43 -14 -79 -12 -81 1 -2 13 14 26 35 31 50 106 131 144 155 19 12 44 17 70 16 34 -3 40 -6 43 -28z" />
<path
android:strokeColor="#FFFFFF"
android:strokeWidth="1"
android:pathData="M1163 894 c-48 -24 -59 -42 -77 -134 -21 -112 -22 -109 20 -126 88 -37 184 44 184 156 0 52 -24 98 -56 110 -32 13 -33 13 -71 -6z" />
<path
android:strokeColor="#FFFFFF"
android:strokeWidth="1"
android:pathData="M1995 930 c-32 -13 -75 -65 -90 -106 -7 -22 -10 -40 -5 -42 22 -8 93 22 125 52 60 57 39 125 -30 96z" />
<path
android:strokeColor="#FFFFFF"
android:strokeWidth="1"
android:pathData="M2329 656 c-41 -28 -53 -48 -36 -65 28 -28 86 5 90 53 3 38 -11 41 -54 12z" />
<path
android:strokeColor="#FFFFFF"
android:strokeWidth="1"
android:pathData="M2639 656 c-41 -28 -53 -48 -36 -65 28 -28 86 5 90 53 3 38 -11 41 -54 12z" />
</group>
</vector>
Thanks in advance for any help!
Use this class
private class VectorDrawableUtils {
Drawable getDrawable(Context context, int drawableResId) {
return VectorDrawableCompat.create(context.getResources(), drawableResId, context.getTheme());
}
Drawable getDrawable(Context context, int drawableResId, int colorFilter) {
Drawable drawable = getDrawable(context, drawableResId);
drawable.setColorFilter(ContextCompat.getColor(context, colorFilter), PorterDuff.Mode.SRC_IN);
return drawable;
}
}
And call it like this
new VectorDrawableUtils().getDrawable(mContext,R.drawable.x,R.color.black);
It's possible to make it so, however, you have to manually change your vector.
Currently, first path contains all letters and rectangle background.
To make all letter white you can use should extract letter in separate path and set fillColor for it. And so on.
BTW, why don't you use custom font for the purpose of text drawing? I think it is much more flexible and better in terms of performance.
Change Fill color if you want to change inside color
If you want change stroke color then change it's color
I need to create an Android drawable where the word oryx is writting using the below vectors:
<glyph glyph-name="O" unicode="O" horiz-adv-x="657" d="M194 268q3 -35 8.5 -55.5t20 -40.5t43.5 -29t74 -9q35 0 60 11t37 25t19 34t8 30t1 22v10.5v16t-1 19.5t-3.5 22.5t-7 22.5t-11 22.5t-17 19.5t-23.5 16.5t-31.5 10.5t-40.5 4q-40 0 -68 -11t-41 -25.5t-20 -38t-7.5 -36.5t0.5 -33v-8zM45 277q-1 6 -1.5 16t3 39 t11.5 55.5t28 58.5t49.5 55t79.5 38.5t114 15.5q45 0 83 -7t65.5 -19t49 -30t35.5 -35.5t23.5 -41.5t14.5 -41.5t7 -41t2.5 -35.5t0 -30.5t-0.5 -20.5q0 -16 -1 -29t-6 -41t-14 -50t-28.5 -48t-46 -43.5t-69 -29.5t-95.5 -12q-55 0 -98 7t-73 18.5t-52.5 31.5t-36.5 41 t-23 52t-13.5 59.5t-7.5 67.5z"/>
<glyph glyph-name="R" unicode="R" horiz-adv-x="459" d="M412 555q-1 -2 0.5 -21t-0.5 -36.5t-8 -37.5t-24.5 -32t-47.5 -12q-42 0 -65 -3t-41 -15t-24 -34t-6 -60v-320q-18 13 -47.5 20.5t-50 11.5t-36.5 23.5t-16 56.5v268q0 6 0.5 16.5t3.5 29t10 37t21 38.5t34 35t51.5 25t70.5 10h99h35h11.5h29.5z"/>
<glyph glyph-name="Y" unicode="Y" horiz-adv-x="684" d="M275 27h134l-86 -189q-38 -41 -92 -41q-24 0 -41.5 12.5t-23.5 24.5l-6 13l110 219q-2 5 -4 11q-36 88 -97 207.5t-87.5 167.5t-42.5 76l16 5t32 9t39.5 3.5t44 -6.5t41.5 -24.5t34 -49.5q14 -40 39.5 -97t44.5 -95t19 -39q67 169 93 244q13 30 33.5 48.5t40.5 24t42.5 5 t38.5 -5t30.5 -9.5t15.5 -5q-87 -175 -168 -372q-16 -37 -38.5 -64t-42 -40.5t-45 -21.5t-40 -9.5t-34.5 -1.5z"/>
<glyph glyph-name="X" unicode="X" horiz-adv-x="648" d="M48 526q15 9 37 15.5t52 8t63 -13.5t59 -47q27 -33 72 -92q54 73 86 118q31 29 71 32.5t69 -10t40 -33.5q-40 -53 -173 -231q149 -199 182 -243q-11 -19 -40 -33t-69 -10.5t-71 32.5q-34 48 -95 130q-51 -67 -81 -104q-26 -32 -59 -47t-63 -13t-52 8t-37 15 q71 98 198 265q-119 157 -189 253z"/>
I created the file drawable/oryx.xml and started with the below code trying to get the letter O but nothing appeared when i used it in the layout file as: android:background="#drawable/oryx"
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="684dp"
android:width="684dp"
android:viewportWidth="684.0"
android:viewportHeight="684.0">
<group
android:name="rotationGroup"
android:pivotX="10.0"
android:pivotY="10.0"
android:rotation="0.0" >
<path
android:name="O"
android:fillColor="#FF000000"
android:pathData="M194 268q3 -35 8.5 -55.5t20 -40.5t43.5 -29t74 -9q35 0 60 11t37 25t19 34t8 30t1 22v10.5v16t-1 19.5t-3.5 22.5t-7 22.5t-11 22.5t-17 19.5t-23.5 16.5t-31.5 10.5t-40.5 4q-40 0 -68 -11t-41 -25.5t-20 -38t-7.5 -36.5t0.5 -33v-8zM45 277q-1 6 -1.5 16t3 39 t11.5 55.5t28 58.5t49.5 55t79.5 38.5t114 15.5q45 0 83 -7t65.5 -19t49 -30t35.5 -35.5t23.5 -41.5t14.5 -41.5t7 -41t2.5 -35.5t0 -30.5t-0.5 -20.5q0 -16 -1 -29t-6 -41t-14 -50t-28.5 -48t-46 -43.5t-69 -29.5t-95.5 -12q-55 0 -98 7t-73 18.5t-52.5 31.5t-36.5 41 t-23 52t-13.5 59.5t-7.5 67.5z"
android:fillAlpha=".3"/>
</group>
</vector>
Can any one help here. the output is required to be as below. thanks
Try this ,
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="3730dp"
android:height="1220dp"
android:viewportWidth="3730"
android:viewportHeight="1220">
<path
android:fillColor="#ed7d31"
android:strokeWidth="1"
android:pathData="M1716 1167 c-14 -15 -26 -34 -26 -44 0 -10 61 -90 135 -178 111 -132 135 -166 135
-192 0 -75 -71 -523 -100 -622 -13 -45 -3 -55 66 -70 108 -25 193 10 213 87 5 20
15 93 21 162 6 69 15 141 19 160 l7 34 93 -129 c52 -72 109 -150 127 -175 48 -66
114 -127 156 -145 59 -24 177 -16 212 16 4 4 -29 52 -74 106 -46 54 -159 196 -251
315 -168 216 -239 287 -321 323 l-33 14 33 1 c19 0 32 5 32 13 0 22 -219 286 -261
314 -29 19 -58 28 -99 31 -53 4 -61 2 -84 -21z" />
<path
android:fillColor="#000000"
android:strokeWidth="1"
android:pathData="M1052 881 c-87 -31 -117 -60 -108 -106 4 -16 43 -136 87 -265 90 -261 120 -317 208
-387 87 -68 150 -83 342 -83 121 0 161 3 165 13 7 18 -22 95 -51 137 -38 54 -73 70
-177 79 -102 8 -148 27 -175 68 -10 15 -59 149 -109 297 -50 148 -95 271 -100 272
-5 0 -42 -11 -82 -25z" />
<path
android:fillColor="#000000"
android:strokeWidth="1"
android:pathData="M2660 896 c-19 -7 -36 -19 -37 -27 -1 -8 92 -99 207 -204 115 -104 210 -193 210
-197 0 -3 -32 -84 -70 -180 -39 -95 -69 -182 -68 -193 4 -25 62 -43 141 -44 96 -1
140 34 192 156 l27 62 110 -99 c119 -108 154 -126 240 -118 26 3 58 12 72 22 47 30
35 55 -76 156 -57 52 -139 127 -182 168 l-79 74 73 180 74 181 -32 28 c-58 52 -165
65 -222 27 -27 -18 -42 -43 -73 -120 l-39 -97 -101 90 c-124 110 -197 149 -276 148
-31 0 -72 -6 -91 -13z" />
<path
android:fillColor="#000000"
android:strokeWidth="1"
android:pathData="M223 875 c-72 -16 -97 -28 -136 -64 -45 -41 -57 -73 -57 -151 0 -231 132 -460 319
-553 179 -90 445 -89 544 1 78 70 90 183 37 342 -47 139 -85 206 -165 286 -78 79
-147 117 -253 140 -83 17 -207 17 -289 -1z m311 -226 c37 -13 67 -34 89 -60 62 -72
102 -217 75 -269 -45 -86 -236 -77 -324 15 -65 67 -111 229 -82 285 27 51 147 65
242 29z" />
<path
android:fillColor="#ffffff"
android:strokeWidth="1"
android:pathData="M0 610 l0 -610 1865 0 1865 0 0 610 0 610 -1865 0 -1865 0 0 -610z m1878 539 c33
-17 69 -53 153 -158 l109 -136 -50 -3 c-66 -4 -65 -24 3 -45 97 -31 162 -91 324
-300 81 -106 192 -245 245 -309 l97 -116 -31 -11 c-45 -16 -123 -14 -166 5 -56 23
-92 63 -223 244 -160 221 -156 217 -168 205 -5 -5 -17 -82 -26 -170 -9 -88 -19
-175 -21 -194 -11 -73 -89 -105 -198 -80 -42 9 -55 16 -51 26 20 54 91 475 100 594
l6 84 -135 160 c-75 88 -136 168 -136 177 0 50 90 65 168 27z m-672 -491 c88 -267
112 -324 145 -355 37 -33 92 -53 151 -53 119 -1 173 -34 208 -127 11 -30 20 -56 20
-58 0 -3 -69 -5 -154 -5 -179 0 -244 15 -325 74 -80 59 -111 118 -200 376 -94 275
-96 283 -83 307 6 10 43 30 84 44 40 15 74 27 75 28 1 0 36 -104 79 -231z m1660
202 c32 -16 103 -68 157 -115 54 -48 104 -85 111 -82 8 3 31 49 52 102 29 75 44
100 65 111 51 26 153 13 200 -25 l23 -18 -75 -182 -74 -183 52 -46 c164 -148 323
-296 323 -301 -1 -27 -52 -51 -108 -51 -74 0 -108 18 -216 115 -57 52 -109 95 -115
95 -6 0 -29 -39 -52 -86 -50 -104 -76 -124 -164 -123 -33 0 -77 6 -97 12 l-37 12
75 184 c41 101 74 186 74 190 0 3 -95 94 -212 201 l-211 194 29 13 c54 23 135 16
200 -17z m-2354 -4 c101 -22 175 -62 243 -130 70 -70 110 -142 155 -276 63 -188 37
-305 -78 -358 -45 -20 -77 -26 -158 -30 -255 -11 -450 95 -551 300 -49 98 -73 199
-73 301 0 84 20 127 77 159 75 44 259 60 385 34z" />
<path
android:fillColor="#ffffff"
android:strokeWidth="1"
android:pathData="M344 679 c-53 -15 -79 -53 -78 -112 1 -140 92 -278 203 -311 102 -30 180 -17 231
39 20 21 25 37 25 79 -2 123 -88 257 -191 295 -57 22 -136 26 -190 10z" />
</vector>
I have uses shape drawable to get rounded coreners but adding a semicircle in between seems tricky.
you can use vector asset studio to draw a custom shape and use it as background for your layout
https://developer.android.com/studio/write/vector-asset-studio.html
You can use Vector Drawable to achieve your end result. I used potrace to convert your image into svg format which is included at the bottom.
Use the Android Studio to create a vector drawable from this svg file.
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="271.000000pt" height="263.000000pt" viewBox="0 0 271.000000 263.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.13, written by Peter Selinger 2001-2015
</metadata>
<g transform="translate(0.000000,263.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M225 2546 c-40 -17 -84 -63 -101 -103 -12 -27 -14 -228 -14 -1140 0
-1093 0 -1107 20 -1149 12 -24 39 -54 62 -70 l41 -29 456 -3 c251 -2 471 0
489 3 23 4 32 11 32 25 0 11 7 20 15 20 8 0 19 16 25 39 14 54 79 124 142 152
74 33 191 33 265 0 61 -27 125 -92 142 -144 7 -21 17 -37 22 -37 5 0 9 -18 9
-40 0 -40 7 -49 25 -31 6 6 151 11 345 13 l335 3 36 24 c20 14 47 41 60 60
l24 35 3 1105 c1 608 0 1121 -3 1139 -8 42 -59 100 -110 123 -36 17 -73 19
-392 19 l-353 0 0 -35 c0 -24 -5 -35 -15 -35 -8 0 -24 -20 -36 -45 -25 -53
-74 -99 -138 -128 -36 -16 -66 -21 -136 -21 -79 -1 -97 3 -147 27 -90 44 -148
127 -148 211 l0 26 -462 0 c-361 -1 -470 -4 -493 -14z m920 -93 c13 -44 28
-67 70 -109 182 -177 521 -113 592 112 l17 54 335 0 c375 0 383 -1 428 -69
l23 -34 -2 -1113 -3 -1112 -25 -27 c-51 -55 -54 -55 -399 -55 l-319 0 -7 32
c-19 86 -84 160 -180 205 -52 24 -73 28 -150 28 -82 0 -97 -3 -157 -33 -84
-41 -143 -105 -164 -179 l-15 -53 -460 0 c-497 0 -487 -1 -539 55 l-25 27 -3
1111 c-2 1096 -2 1112 18 1145 11 18 34 41 52 52 32 19 52 20 465 20 l432 0
16 -57z"/>
</g>
</svg>
What factors do I need to look at when benchmarking the performance of an android device with swap enabled? and what applications are recommended to use if there are any?
Enabling swap requires the phone to be rooted and it's kernel to support swap. "a-swapper" is one of the applications I use for enabling swap, basically it launches commands to enable swap. The swap file or swap partition is located at the external SD card.
Link to "a-swapper" at google code:
http://code.google.com/p/a-swapper/
Following is a report of my paging tests on a Raspberry Pi (ARM CPU, 512 MB RAM, SD drive). A test program writes and reads increasing volumes of data, checking for correct results and measuring speed in MB/second. Data sizes reported are 350, 400, 420 and 600 MB. Speed was at about one tenth max at 420 MB and three times slower at 600 MB. Links are included to obtain the benchmarks and C source code (FREE for anyone to play with and no Ads on any pages). As with my other benchmarks, this can be converted for Android.
http://www.roylongbottom.org.uk/Raspberry%20Pi%20Stress%20Tests.htm#anchor18
The report also provides vmstat monitoring of memory used, swapped, cache size, drive I/O and CPU utilisation. At least on my Android tablet, I can run vmstat via a Terminal Emulator at the same time as executing benchmarks.
For Windows and Linux, I have an image processing benchmark that increasingly enlarges images, with writing and reading to a drive, rotating and scrolling (You can find details by Googling for bmpspeed results.htm and Linux SDL Image Processing Benchmarks). If there is a suitable photo editor for Android, you can do the same with that using manual timing, and possibly monitor with vmstat.
Paging Test Results
StressInt uses normal memory writing and reading functions. Part 1 writes then reads the specified space with six passes using different data patterns. Reading is at high speed using AND and OR to produce a sumcheck. Part 2 writes the patterns (not timed) and reads them for at least a minimum time, in this case there is only one read pass for each pattern. The four paging tests specified 350, 400, 420 and 600 MB on a Raspberry Pi that has 512 MB RAM, with the main drive being an SD card. Vmstat was run at the same time.
At 350 MB, there is no swapping, but cache and buffer sizes are reduced, slowing down the first write pass. At 400 KB, swapping in and out at start then full speed when sorted. At 420 MB, chaos, continuous data transfer to and from the drive, CPU waiting for I/O.
1. Commands Example
lxterminal -e ./stressInt KB 600000
vmstat 10 > vmburn4.txt
2. Results
MBytes Per Second At MB Data Size
MB 350 400 420 600
Write/Read No.
1 139 24 15 14
2 209 181 16 8
3 206 203 24 8
4 206 204 26 8
5 202 205 18 8
6 206 205 20 8
Write/Rd secs 19.6 48.4 204.9 460.7
Read No.
1 158 159 20 9
2 158 159 14 9
3 159 159 39 8
4 160 155 9 9
5 159 160 25 9
6 160 159 10 9
Total secs 85 125 1082 3085
vmstat si so KB swaps in and out, bi bo KB I/O in and out, wa = waiting for I/O
350 MB vmstat 10 second samples
KBytes KB KB/sec Per sec %
procs ----------memory---------- ---swap-- -----io---- -system-- ----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 0 314260 12340 56724 0 0 70 3 1123 232 19 5 76 0
1 1 4 8920 48 21844 0 0 37 10 1141 298 42 16 42 0
1 0 8 12392 64 18404 0 0 2 9 1161 89 99 1 0 0
1 0 8 12144 80 18704 0 0 30 6 1167 82 99 1 0 0
1 0 8 11896 88 18868 0 0 16 2 1157 71 99 1 0 0
1 0 8 11764 96 18972 0 0 10 7 1163 71 99 1 0 0
1 0 8 11772 104 18972 0 0 0 3 1152 61 100 0 0 0
1 0 8 11772 112 18972 0 0 0 3 1153 65 100 0 0 0
1 0 8 11772 120 18972 0 0 0 4 1154 68 100 0 0 0
1 0 8 11772 128 18972 0 0 0 3 1153 64 100 0 0 0
0 0 8 362344 136 21384 0 0 239 5 1194 294 22 4 73 1
400 MB
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 8 355220 924 26480 0 0 63 3 1125 236 24 4 72 0
1 5 92368 8968 60 5464 10 9236 338 9245 1739 587 31 20 28 21
0 2 52492 9108 44 5092 4775 3802 6938 3807 3429 1169 10 22 0 68
1 2 71168 11236 44 4920 4654 8936 4929 8936 2428 1036 6 18 0 77
1 1 42216 9224 44 4788 4477 5600 5059 5602 3313 992 37 19 0 45
1 1 40948 11008 44 4932 143 0 591 3 1391 163 98 2 0 0
1 0 40924 12248 60 5032 15 0 33 6 1170 87 98 2 0 0
1 0 40912 12116 60 5228 2 0 21 0 1155 66 99 1 0 0
1 0 40912 12000 68 5228 0 0 0 3 1152 58 100 1 0 0
1 0 40912 12000 76 5260 3 0 6 3 1154 60 100 1 0 0
1 0 40892 12000 84 5260 0 0 0 3 1153 63 99 1 0 0
1 0 40704 11628 92 5260 34 0 34 3 1167 69 100 1 0 0
1 0 40700 11628 100 5260 0 0 0 3 1153 61 100 0 0 0
0 0 37956 401996 236 12804 474 0 1208 0 1626 229 89 5 3 3
0 0 36900 400392 244 13372 103 0 160 7 1125 180 6 2 91 1
420 MB Sample
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 3 59316 8820 48 4212 4238 4269 5132 4272 3592 939 20 16 0 65
0 1 68268 11732 44 3400 4281 5112 4736 5114 3337 938 6 19 0 75
1 3 60804 8820 76 4428 4715 3860 5877 3864 3518 1007 13 17 0 70
1 1 56408 9948 44 2976 4710 4164 6948 4168 4389 1186 5 19 0 75
2 2 70864 11704 44 2068 3975 6458 4908 6461 3854 1021 7 14 0 79
Following are results on 64 bit Windows systems, essentially from same C code as on Raspberry Pi but using one write/read pass. For these tests the benchmark was run with increasing data demands up to 5, 8 and 14 GB on the three systems.
64 Bit IntBurn64 64 Bit IntBurn64 64 Bit IntBurn64
CPU Athlon 64 Core 2 Duo Phenom II
MHz 2210 2400 3000
RAM MB 1024 4096 8192
Windows XP x64 64-Bit Vista 64-Bit Windows 7
Disk W/R
MB/sec 55 55 92
KB Secs MB/sec KB Secs MB/sec KB Secs MB/sec
100000 2041 100000 3393 100000 5146
800000 1 1976 2500000 2 2868 2000000 1 4900
850000 23 77 3000000 2 2878 3000000 1 4658
900000 58 32 3100000 2 2847 3500000 2 4651
920000 61 31 3200000 2 2899 4000000 2 4488
930000 91 21 3300000 3 2698 4500000 2 4489
940000 96 20 3400000 3 2610 5000000 2 4477
950000 93 21 3500000 7 1075 5500000 3 4166
960000 89 22 3600000 10 750 6000000 3 4051
970000 142 14 3700000 17 459 6500000 3 4036
980000 125 16 3800000 107 73 7000000 4 4078
990000 119 17 3900000 210 38 7500000 72 214
1000000 128 16 4000000 146 56 7600000 170 91
1100000 188 12 7700000 168 94
1200000 205 12 5000000 1024 10 7800000 230 69
1300000 266 10 7000000 652 22 7900000 239 68
1400000 358 8 7900000 770 21 8000000 227 72
8000000 N/A 9000000 697 26
2000000 683 6 10000000 1231 17
2100000 14000000 2742 10
5000000 1707 6 15000000 N/A
BMPSpeed Benchmark generates BMP files up to 512 MB. It measures speed of saving, loading, scrolling, rotating and editing/enlarging of 0.5, 1, 2, 4 etc. MB files upwards. Memory used is up to 2.5 times image size. The original had to be modifies for a Windows XP as 1.25 GB of sequential memory space could not be allocated. The first example below reflects paging at 256 MB but some memory would be cleared for a rerun. A second problem arises on later systems, with more graphics RAM, where fast BitBlt copying can be used at larger image sizes and this requires far more space than the slower StretchDIBits method.
I might produce a new 64 bit version to see if I can bust my new benchmarking toy with 32 GB RAM.
BMPSpeed Results
2.08 GHz CPU, 512 MB RAM, fast disk, slow GeForce graphics
Input Enlarge Save Load Scroll Scroll Rotate Use
Image Display Display /Repeat Overall 90 deg Fast
Mbytes Secs Secs Secs msecs MB/Sec Secs BitBlt
0.5 0.05 0.01 0.03 0.7 992.8 0.04 3
1.0 0.06 0.02 0.05 1.3 1013.2 0.06 3
2.0 0.08 0.03 0.12 2.3 1019.8 0.09 3
4.0 0.11 0.06 0.17 2.9 1032.4 0.15 3
8.0 0.15 0.14 0.43 11.4 262.7 0.25 3
16.0 0.24 0.29 0.51 11.4 262.7 0.81 3
32.0 0.45 0.61 0.88 11.4 262.5 1.10 3
64.0 0.55 1.31 1.49 41.4 72.2 2.79 0
128.0 0.97 2.50 2.83 53.9 55.5 6.21 0
256.0 73.02 88.77 14.84 109.7 27.3 86.60 0
512.0 82.93 20.70 89.05 842.4 3.5 67.98 0
2.4 GHz Core 2 Duo with 4 GB RAM and 64 Bit Vista, fast GeForce
Input Enlarge Save Load Scroll Scroll Rotate Use
Image Display Display /Repeat Overall 90 deg Fast
Mbytes Secs Secs Secs msecs MB/Sec Secs BitBlt
0.5 0.05 0.01 0.05 0.1 4748.4 0.02 3
1.0 0.05 0.02 0.08 0.3 4463.6 0.03 3
2.0 0.07 0.02 0.11 1.1 2475.2 0.04 3
4.0 0.09 0.03 0.19 2.4 1866.0 0.06 3
8.0 0.13 0.08 0.31 2.9 1765.0 0.10 3
16.0 0.20 0.24 0.48 2.7 1832.5 0.17 3
32.0 0.26 0.52 0.78 2.9 1741.2 0.28 3
64.0 0.39 1.08 1.38 2.9 1760.0 0.52 3
128.0 0.68 2.37 2.63 2.9 1740.3 1.03 3
256.0 1.35 4.62 5.38 3.1 1645.6 4.39 3
512.0 27.91 13.05 10.59 3.2 1595.6 57.11 3