English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
AGI research using ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-03-13 (16:00)
From: blue storm <bluestorm.dylc@g...>
Subject: Re: [Caml-list] AGI research using ocaml
If you control the code, the easiest way is to :
- add runtime profiling functions directly inside the generated code (for
example, one before each function call and sequencing construct)
- hardcode into your profiling functions the fact that, after a certain
number of steps, excecution should be aborted.

Example :

  let count = ref 0
  let max_count = 100 (* you choose that constant during generation *)
  exception Terminated
  let step () =
    incr count;
    if !count > max_count then raise Terminated

  (* generated code *)
  let code () =
    ... ; step (); ...; step () ; ...

You could probably also have max_count passed as a parameter at execution
time (allowing you to execute the same generated code with different time