File: HOOK.pl

package info (click to toggle)
gprolog 1.4.5.0-3
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 7,924 kB
  • sloc: ansic: 55,584; perl: 18,501; sh: 3,401; makefile: 1,114; asm: 20
file content (24 lines) | stat: -rw-r--r-- 434 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
% hook file for SWI Prolog
% Count is passed on the command line as the last argument (1st is 'pl')

get_count(Count) :-
	unix(argv(L)),
	get_last(L, ACount),
	atom_codes(ACount, LCodes),
	number_codes(Count, LCodes).

get_last([Count], Count):-
	!,
	sub_atom(Count, 0, 1, _, X),
	X @>= '0',
	X @=< '9'.

get_last([_|L], Count):-
	get_last(L, Count).


get_cpu_time(T) :-
	statistics(cputime, X),
	T is X*1000.

:- initialization(q).