File: HOOK.pl

package info (click to toggle)
gprolog 1.5.0-0.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,912 kB
  • sloc: ansic: 57,412; perl: 18,500; sh: 3,677; makefile: 1,123; asm: 97
file content (24 lines) | stat: -rw-r--r-- 434 bytes parent folder | download | duplicates (7)
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).