Improve file_parse_proc_smaps() performance
Improve file_parse_proc_smaps() performance

Improve performance of the file_parse_proc_smaps() function, that is
used for parsing /proc/pid/smaps files. Instead of feeding all input
lines to scanf(), parse the lines in more manual fashion.

This has direct effect e.g. for mem-cpu-monitor, so let's quickly check
how much of a difference this makes on N9 with some process that has
very large /proc/pid/smaps:

$ wc -l /proc/2954/smaps
17906 /proc/2954/smaps

Before this patch:

$ mem-cpu-monitor -i 0.1 2954
System: CPU: 1000 MHz max, total memory: 1008648 kB RAM, 262136 kB swap
____________ __________________ ___________ _______________________________
            |  system memory   |system CPU |PID 2954 camera-ui -prestart
   time:    |     used: change:|    %: MHz:|  clean:  dirty: change: CPU-%:
06:05:20.742     414912      +0 100.0% 1000     7036   14832      +0 0.0%
06:05:20.842     414912      +0  70.0% 1000     7036   14832      +0 0.0%
06:05:20.942     414912      +0  70.0% 1000     7036   14832      +0 0.0%
06:05:21.042     414912      +0  77.8% 1000     7036   14832      +0 0.0%
06:05:21.142     414912      +0  72.7% 1000     7036   14832      +0 0.0%
06:05:21.242     414912      +0  80.0% 1000     7036   14832      +0 0.0%
06:05:21.342     414912      +0  66.7% 1000     7036   14832      +0 0.0%
06:05:21.442     414912      +0  72.7% 1000     7036   14832      +0 0.0%
06:05:21.542     414912      +0  70.0% 1000     7036   14832      +0 0.0%

After this patch:

$ mem-cpu-monitor -i 0.1 2954
System: CPU: 1000 MHz max, total memory: 1008648 kB RAM, 262136 kB swap
____________ __________________ ___________ _______________________________
            |  system memory   |system CPU |PID 2954 camera-ui -prestart
   time:    |     used: change:|    %: MHz:|  clean:  dirty: change: CPU-%:
06:05:13.407     414920      +0 100.0% 1000     7036   14832      +0 0.0%
06:05:13.507     414920      +0  44.4% 1000     7036   14832      +0 0.0%
06:05:13.607     414920      +0  41.7% 1000     7036   14832      +0 0.0%
06:05:13.707     414920      +0  40.0% 1000     7036   14832      +0 0.0%
06:05:13.807     414920      +0  37.5% 1000     7036   14832      +0 0.0%
06:05:13.907     414920      +0  45.5% 1000     7036   14832      +0 0.0%
06:05:14.007     414920      +0  50.0% 1000     7036   14832      +0 0.0%
06:05:14.107     414920      +0  30.0% 1000     7036   14832      +0 0.0%
06:05:14.207     414920      +0  45.5% 1000     7036   14832      +0 0.0%

philippedeswert/libsp-measure,maemo-tools-old/sp-measure