Commit 9a044d9d authored by Nicola Amadio's avatar Nicola Amadio
Browse files

add other fields to the log file

parent 67e9e7ff
......@@ -7,9 +7,11 @@
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="freud-java-serialization" />
<module name="freud-experiments" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="freud-experiments" target="11" />
<module name="freud-java-serialization" target="11" />
</bytecodeTargetLevel>
</component>
......
......@@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/freud-java-serialization.iml" filepath="$PROJECT_DIR$/freud-java-serialization.iml" />
<module fileurl="file://$PROJECT_DIR$/freud-experiments.iml" filepath="$PROJECT_DIR$/freud-experiments.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_11">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.google.guava:guava:19.0" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:30.0-jre" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.checkerframework:checker-qual:3.5.0" level="project" />
<orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.3.4" level="project" />
<orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.5" level="project" />
</component>
</module>
\ No newline at end of file
......@@ -25,6 +25,18 @@ public class Main {
fos.write(intToByteArray(myObject.getNameLen()));
fos.write(myObject.getFname().getBytes());
fos.write(intToByteArray(myObject.getFeatureNamesCount()));
fos.write(intToByteArray(myObject.getTypeNamesCount()));
fos.write(intToByteArray(myObject.getSamplesCount()));
fos.write(intToByteArray(myObject.getUidR()));
fos.write(longToBytes(myObject.getTime()));
fos.write(longToBytes(myObject.getMem()));
fos.write(longToBytes(myObject.getLockHoldingTime()));
fos.write(longToBytes(myObject.getWaitingTime()));
fos.write(longToBytes(myObject.getMinorPageFaults()));
fos.write(longToBytes(myObject.getMajorPageFaults()));
fos.write(intToByteArray(myObject.getNumOfFeatures()));
fos.write(intToByteArray(myObject.getNumOfBranches()));
fos.write(intToByteArray(myObject.getNumOfChildren()));
fos.close();
}
......@@ -34,12 +46,39 @@ public class Main {
return bytes;
}
public static byte[] longToBytes(long x) {
ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES);
buffer.putLong(x);
byte[] array = buffer.array();
ArrayUtils.reverse(array);
return array;
}
private static void fillObject(TestClassToSerialize myObject) {
// file name
myObject.setNameLen(15);
myObject.setFname("_Z9test_loopPii");
myObject.setFeatureNamesCount(4);
// myObject.setVnlen(2);
// myObject.setVname("as");
// feature names
myObject.setFeatureNamesCount(0);
// type names
myObject.setTypeNamesCount(0);
// ..
// samples
myObject.setSamplesCount(1);
// sample
myObject.setUidR(0);
myObject.setTime(1240);
myObject.setMem(0);
myObject.setLockHoldingTime(0);
myObject.setWaitingTime(0);
myObject.setMinorPageFaults(0);
myObject.setMajorPageFaults(0);
// features
myObject.setNumOfFeatures(0);
// branches
myObject.setNumOfBranches(0);
// children
myObject.setNumOfChildren(0);
}
}
......@@ -49,34 +49,188 @@ public class TestClassToSerialize implements Serializable {
return vname;
}
// // TYPE NAMES
// int type_names_count;
// // int vnlen;
// String tname;
//
// int samples_count;
// int uid_r;
// int time;
// int mem;
// int lock_holding_time;
// int waiting_time;
// int minor_page_faults;
// int major_page_faults;
//
// // NUM OF FEATURES
// int num_of_features;
// int name_offset;
// int type_offset;
// int value;
//
// // BRANCHES
// int num_of_branches;
// int branch_id;
// int num_of_executions;
// bool taken;
//
// // CHILDREN
// int num_of_children;
// int c_id;
public int getTypeNamesCount() {
return typeNamesCount;
}
public void setTypeNamesCount(int typeNamesCount) {
this.typeNamesCount = typeNamesCount;
}
// TYPE NAMES
int typeNamesCount;
int tnlen;
String tname;
public int getSamplesCount() {
return samplesCount;
}
public void setSamplesCount(int samplesCount) {
this.samplesCount = samplesCount;
}
// SAMPLES
int samplesCount;
int uidR;
public int getUidR() {
return uidR;
}
public void setUidR(int uidR) {
this.uidR = uidR;
}
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
public long getMem() {
return mem;
}
public void setMem(long mem) {
this.mem = mem;
}
public long getLockHoldingTime() {
return lockHoldingTime;
}
public void setLockHoldingTime(long lockHoldingTime) {
this.lockHoldingTime = lockHoldingTime;
}
public long getWaitingTime() {
return waitingTime;
}
public void setWaitingTime(long waitingTime) {
this.waitingTime = waitingTime;
}
public long getMinorPageFaults() {
return minorPageFaults;
}
public void setMinorPageFaults(long minorPageFaults) {
this.minorPageFaults = minorPageFaults;
}
public long getMajorPageFaults() {
return majorPageFaults;
}
public void setMajorPageFaults(long majorPageFaults) {
this.majorPageFaults = majorPageFaults;
}
long time;
long mem;
long lockHoldingTime;
long waitingTime;
long minorPageFaults;
long majorPageFaults;
public int getNumOfFeatures() {
return numOfFeatures;
}
public void setNumOfFeatures(int numOfFeatures) {
this.numOfFeatures = numOfFeatures;
}
public long getNameOffset() {
return nameOffset;
}
public void setNameOffset(long nameOffset) {
this.nameOffset = nameOffset;
}
public long getTypeOffset() {
return typeOffset;
}
public void setTypeOffset(long typeOffset) {
this.typeOffset = typeOffset;
}
public long getValue() {
return value;
}
public void setValue(long value) {
this.value = value;
}
// NUM OF FEATURES
int numOfFeatures;
long nameOffset;
long typeOffset;
long value;
public int getNumOfBranches() {
return numOfBranches;
}
public void setNumOfBranches(int numOfBranches) {
this.numOfBranches = numOfBranches;
}
public int getBranchId() {
return branchId;
}
public void setBranchId(int branchId) {
this.branchId = branchId;
}
public int getNumOfExecutions() {
return numOfExecutions;
}
public void setNumOfExecutions(int numOfExecutions) {
this.numOfExecutions = numOfExecutions;
}
public boolean isTaken() {
return taken;
}
public void setTaken(boolean taken) {
this.taken = taken;
}
public int getNumOfChildren() {
return numOfChildren;
}
public void setNumOfChildren(int numOfChildren) {
this.numOfChildren = numOfChildren;
}
public int getcId() {
return cId;
}
public void setcId(int cId) {
this.cId = cId;
}
// BRANCHES
int numOfBranches;
int branchId;
int numOfExecutions;
boolean taken;
// CHILDREN
int numOfChildren;
int cId;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment