Advertisement
logicmoo

Untitled

Dec 25th, 2014
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 1.02 KB | None | 0 0
  1. :-export(mstatistics/0).
  2. mstatistics:-
  3.   garbage_collect,
  4.   garbage_collect_atoms,
  5.   statistics,
  6.   statistics(stack,Om),O is Om/1000000,
  7.   statistics(clauses,C),
  8.   statistics(memory,[Tm,_]),T is Tm/1000000,
  9.   statistics(atoms,[A,Mm,0]),AM is Mm/1000000,
  10.   OdC is O/C,
  11.   OdA is (A/1000)*39,
  12.   PerAtom is (Mm/A),
  13.   list_new_atoms(L,NA),
  14.   save_atoms,
  15.   fmt((stack/clauses/mem/new + O/C/T/NA = c(OdC)/a(OdA-AM-PerAtom))),!,
  16.   (NA<1000->fmt(L);true).
  17.  
  18. current_atom_or_blob(X,atom):-current_atom(X).
  19. current_atom_or_blob(X,blob(T)):-current_blob(X,T).
  20. current_atom_or_blob(X,functor):-current_functor(X,_).
  21. current_atom_or_blob(X,key):-current_key(X).
  22. current_atom_or_blob(X,flag):-current_key(X).
  23.  
  24. :-dynamic(saved_current_atom/1).
  25. :-export(new_atoms/1).
  26. new_atoms(X,Type):-current_atom_or_blob(X,Type),not(saved_current_atom(X)).
  27. :-export(save_atoms/0).
  28. save_atoms:-forall(new_atoms(X,_Type),assert(saved_current_atom(X))).
  29. :-export(list_new_atoms/2).
  30. list_new_atoms(L,NA):-findall(X-Type,new_atoms(X,Type),L),length(L,NA).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement