Last active
April 28, 2022 13:18
-
-
Save tasosxak/57e8338909939e10de24aca7350f383b to your computer and use it in GitHub Desktop.
tracemonitor_runtime_with_master.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var moni_ = new PropertyMonitor | |
def eval(event: String): Boolean = { | |
//println("MONITOR RECEIVED: ", event) | |
openResultFile("dejavu-results") | |
var input = event.split(",") | |
var name = input(0) | |
var args = new ListBuffer[Any]() | |
Options.BITS = 20 | |
for (i <- 1 until input.length) { | |
args += input(i) | |
} | |
moni_.lineNr+=1 | |
//println("arguments:", args.toList) | |
moni_.submit(name, args.toList) | |
//println("%d",moni_.lineNr) | |
closeResultFile() | |
return true; | |
} |
How to create a monitor for FMI master?
- Write the property in dejavu
- Execute the first command above
- Add the function named "eval" and the object moni_ in TraceMonitor object of the file TraceMonitor.scala
- Complete the next commands of the above description (step 2)
- Add the TraceMonitor.jar file path in the FMI Master code
- Compile the FMI Master
How to compile the Master with the monitor jar file ?
g++ src/DEPLOY_TEMPLATE.cpp -I includes -I/usr/lib/jvm/java-1.11.0-openjdk-amd64/include/ -I/usr/lib/jvm/java-1.11.0-openjdk-amd64/include/linux -L/lib64 -Lbip_example -ljvm -ldl -o master
Problems with libjvm.so ?
sudo ln -s /usr/lib/jvm/java-1.11.0-openjdk-amd64/lib/server/libjvm.so /lib/x86_64-linux-gnu/libjvm.so
If you want to find a java function's signature in bytecode format run:
javap -v -classpath TraceMonitor.jar TraceMonitor
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Extracting a runtime monitor in order to import to a C++ FMI master.
$DEJAVU=~/dejavu/dir
You can run the program to verify that until now all works as expected:
3. scala -cp $DEJAVU/dejavu.jar TraceMonitor.jar log1.csv
Make the TraceMonitor.class file as main class file of the jar
4. jar --update --verbose --file TraceMonitor.jar --main-class TraceMonitor
Run:
5. java -cp $DEJAVU/dejavu.jar:/usr/share/scala-2.11/lib/scala-library.jar:TraceMonitor.jar TraceMonitor log1.csv
Now you can run the monitor as jar with the necessary depedencies.