This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/Logtalk/examples/profiling/NOTES

34 lines
1.2 KiB
Plaintext
Raw Normal View History

=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.26.2
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
To load this example and for sample queries, please see the SCRIPT file.
You will also need to load the following files in the library directory:
types_loader, events_loader, metapredicates_loader, and dates_loader.
Alternatively, you may simply load the library all_loader file to load all
library entities.
This is a very simple example of the use of events and monitors to make
profilers for an application. It's easy to modify to make it do much more.
For instance, most Prolog compilers give you access to data concerning space
usage (stacks, heap, etc).
The example defines three objects:
message_counter
using events, this object allows us to count the messages sent to
spied objects
stop_watch
using events, this object simply prints the CPU time before and after
a message sent to a spied object
timer
this object implements a method that sends a message to an object a
specified number of times, returning the average execution time