Megatest

Check-in [28b4ff78b6]
Login
Overview
Comment:Converted whodunit to chicken 5
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65
Files: files | file ages | folders
SHA1: 28b4ff78b69ef669b6ef88299eb2f1d077b7e1b8
User & Date: jmoon18 on 2020-11-20 13:10:00
Other Links: branch diff | manifest | tags
Context
2020-11-24
21:21
Added dep for whodunit. check-in: cd7bf0e858 user: mrwellan tags: v1.65
2020-11-20
13:10
Converted whodunit to chicken 5 check-in: 28b4ff78b6 user: jmoon18 tags: v1.65
11:13
Bit of clean up on whodunit check-in: 0e9324f845 user: mrwellan tags: v1.65
Changes

Added utils/Makefile.whodunit version [e57c664f04].










1
2
3
4
5
6
7
8
9
+
+
+
+
+
+
+
+
+
.DEFAULT : all

all : whodunit

clean : 
	rm whodunit

whodunit : 
	csc -static -L -static -L -lm -L -ldl -L -lpthread -L -lssl -L -lcrypto -L -lz whodunit.scm -o whodunit 

Modified utils/whodunit.scm from [53b5450f55] to [f5e767ace5].

11
12
13
14
15
16
17
18
19
20
21
22

23
24









25
26
27
28
29
30
31
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







-




+
-
-
+
+
+
+
+
+
+
+
+







;;     but WITHOUT ANY WARRANTY; without even the implied warranty of
;;     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;     GNU General Public License for more details.
;; 
;;     You should have received a copy of the GNU General Public License
;;     along with Megatest.  If not, see <http://www.gnu.org/licenses/>.
;;

(module whodunit

 *


(import scheme chicken data-structures extras)
(use posix srfi-69)
(import 
  (chicken process-context)
  (chicken process)
  (chicken string)
  (chicken sort)
  (chicken io)
  srfi-69
  scheme
)

(define *numsamples* (or (and (> (length (argv)) 1)
                              (string->number (cadr (argv))))
                         3))

(define (topdata)
  (with-input-from-pipe
53
54
55
56
57
58
59
60

61
62
63
64
65
66
67
60
61
62
63
64
65
66

67
68
69
70
71
72
73
74







-
+







     (let ((pid (car indat))
           (usr (cadr indat))
           (cpu (list-ref indat 8)))
       (hash-table-set! ht usr (+ cpu (hash-table-ref/default ht usr 0)))))
   data))

)
(import whodunit)
(import whodunit srfi-69 (chicken sort))

(print "Getting " *numsamples* " samples of cpu usage data.")
(define data (cleanup-data (topdata)))
(define pidhash  (make-hash-table))
(define userhash (make-hash-table))
(sum-up data userhash)