Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
EngineCallBacks.statusCallBack - call back function for handling resource usage messages
Calling Sequence
void statusCallBack( Object data, long bytesUsed, long bytesAlloc, double cputime ) throws MapleException
Parameters
data
-
arbitrary data that was passed into the Engine constructor
bytesUsed
number of bytes of memory used by the Maple engine
bytesAlloc
number of bytes of memory allocated from the system
cputime
number of seconds of CPU time used by the Maple engine
Description
statusCallBack is a member function of the com.maplesoft.openmaple.EngineCallBacks interface. It is called by the Maple engine to report resource usage.
Examples
import com.maplesoft.openmaple.*;
import com.maplesoft.externalcall.MapleException;
class Example
{
static private class CallBacks implements EngineCallBacks
double last;
boolean limitExceeded;
CallBacks()
last = 0.0;
limitExceeded = false;
}
public void textCallBack( Object data, int tag, String output )
throws MapleException
switch ( tag )
case MAPLE_TEXT_OUTPUT:
System.out.print( "Text: " );
break;
case MAPLE_TEXT_DIAG:
System.out.print( "Diag: " );
case MAPLE_TEXT_MISC:
System.out.print( "Misc: " );
case MAPLE_TEXT_HELP:
System.out.print( "Help: " );
case MAPLE_TEXT_QUIT:
System.out.print( "Quit: " );
case MAPLE_TEXT_WARNING:
System.out.print( "Warning: " );
case MAPLE_TEXT_DEBUG:
System.out.print( "Debug: " );
System.out.println( output );
public void errorCallBack( Object data, int offset, String msg )
if ( offset >= 0 )
throw new MapleException( "Error: "+msg );
else
throw new MapleException( "syntax error at offset "+offset+
": "+msg );
public void statusCallBack( Object data, long kbused, long kballoced,
double timeused )
if ( timeused > 5 )
limitExceeded = true;
if ( timeused-last > 1 )
System.out.println( "Status: used = "+kbused+", alloced = "+
kballoced+", time = "+timeused );
last = timeused;
public String readLineCallBack( Object data, boolean debug )
return "readline";
public boolean redirectCallBack( Object data, String output, boolean
append )
System.out.println( "redirect to "+output+" append = "+append );
return true;
public String callBackCallBack( Object data, String output )
System.out.println( "callback: "+output );
return output+";";
public boolean queryInterrupt( Object data )
return limitExceeded;
public String streamCallBack( Object data, String name, String args[] )
StringBuffer sbuf;
int i;
sbuf = new StringBuffer( name );
for ( i = 0; i < args.length; i++ )
sbuf.append( args[i] );
return sbuf.toString();
public static void main( String notused[] ) throws MapleException
String mapleArgs[];
Engine engine;
Algebraic a;
mapleArgs = new String[1];
mapleArgs[0] = "java";
engine = new Engine( mapleArgs, new CallBacks(), null, null );
for ( i = 0; i < 2000; i++ )
a = engine.evaluate( "Array( 1..10^5 ):" );
if ( a == null )
a.dispose();
Executing this code produces output similar to the following.
Status: used = 44985, alloced = 1503, time = 1.02
Status: used = 102634, alloced = 1503, time = 2.029
Status: used = 161259, alloced = 1503, time = 3.0400000000000005
See Also
ExternalCalling/Java/MapleException, OpenMaple, OpenMaple/Java/Engine, OpenMaple/Java/Engine/Engine, OpenMaple/Java/EngineCallBacks, OpenMaple/Java/EngineCallBacksDefault, OpenMaple/Java/EngineCallBacksDefault/statusCallBack
Download Help Document