Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nicola Amadio
freud-java-serialization
Commits
abb01f02
Commit
abb01f02
authored
Jan 07, 2021
by
Nicola Amadio
Browse files
make serialization read from log files generated by freud-java-instrumentation
parent
93cc5561
Changes
8
Hide whitespace changes
Inline
Side-by-side
.idea/libraries/Maven__junit_junit_4_12.xml
0 → 100644
View file @
abb01f02
<component
name=
"libraryTable"
>
<library
name=
"Maven: junit:junit:4.12"
>
<CLASSES>
<root
url=
"jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
0 → 100644
View file @
abb01f02
<component
name=
"libraryTable"
>
<library
name=
"Maven: org.hamcrest:hamcrest-core:1.3"
>
<CLASSES>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/"
/>
</CLASSES>
<JAVADOC>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/"
/>
</JAVADOC>
<SOURCES>
<root
url=
"jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/"
/>
</SOURCES>
</library>
</component>
\ No newline at end of file
freud-experiments.iml
View file @
abb01f02
...
...
@@ -18,5 +18,7 @@
<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"
/>
<orderEntry
type=
"library"
name=
"Maven: junit:junit:4.12"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.hamcrest:hamcrest-core:1.3"
level=
"project"
/>
</component>
</module>
\ No newline at end of file
my-symbols/_nicola_test/idcm__nicola_test_12493.bin
View file @
abb01f02
No preview for this file type
pom.xml
View file @
abb01f02
...
...
@@ -31,6 +31,12 @@
<artifactId>
commons-lang
</artifactId>
<version>
2.5
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.12
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
src/main/java/Main.java
View file @
abb01f02
...
...
@@ -19,8 +19,7 @@ public class Main {
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
symbolName
=
args
[
0
];
PATHNAME
=
"my-symbols/_nicola_test/idcm_"
+
symbolName
+
"_"
+
RANDOMNUMBER
+
".bin"
;
int
numOfSamples
=
Integer
.
parseInt
(
args
[
1
]);
TestClassToSerialize
myObject
=
new
TestClassToSerialize
(
symbolName
,
numOfSamples
);
TestClassToSerialize
myObject
=
new
TestClassToSerialize
(
symbolName
);
createBinaryFile
(
myObject
);
}
...
...
@@ -55,12 +54,10 @@ public class Main {
fos
.
write
(
longToByteArray
(
sample
.
getMinorPageFaults
()));
fos
.
write
(
longToByteArray
(
sample
.
getMajorPageFaults
()));
fos
.
write
(
intToByteArray
(
sample
.
getNumOfFeatures
()));
int
i
=
0
;
for
(
FreudFeature
feature:
sample
.
getFeatures
())
{
for
(
FreudFeature
feature:
sample
.
getFeatureList
())
{
fos
.
write
(
longToByteArray
(
20
));
fos
.
write
(
longToByteArray
(
feature
.
getTypeOffset
()));
fos
.
write
(
longToByteArray
(
feature
.
getValue
()));
i
++;
}
fos
.
write
(
intToByteArray
(
sample
.
getNumOfBranches
()));
fos
.
write
(
intToByteArray
(
sample
.
getNumOfChildren
()));
...
...
src/main/java/Sample.java
View file @
abb01f02
...
...
@@ -2,20 +2,21 @@ import java.util.LinkedList;
import
java.util.List
;
public
class
Sample
{
private
int
uidR
;
private
long
time
;
private
long
mem
;
private
long
lockHoldingTime
;
private
long
waitingTime
;
private
long
minorPageFaults
;
private
long
majorPageFaults
;
private
int
numOfFeatures
;
private
int
numOfBranches
;
private
int
numOfChildren
;
private
List
<
FreudFeature
>
feature
s
;
private
final
int
uidR
;
private
final
long
time
;
private
final
long
mem
;
private
final
long
lockHoldingTime
;
private
final
long
waitingTime
;
private
final
long
minorPageFaults
;
private
final
long
majorPageFaults
;
private
final
int
numOfFeatures
;
private
final
int
numOfBranches
;
private
final
int
numOfChildren
;
private
final
List
<
FreudFeature
>
feature
List
;
// currently this list is always of one element
public
Sample
(
long
time
)
{
this
.
time
=
time
*
time
;
// featureVal will become a list once freud-java will support multiple features
public
Sample
(
Long
featureVal
,
long
time
)
{
this
.
time
=
time
;
uidR
=
(
int
)
time
;
mem
=
0
;
lockHoldingTime
=
0
;
...
...
@@ -25,9 +26,8 @@ public class Sample {
numOfFeatures
=
1
;
numOfBranches
=
0
;
numOfChildren
=
0
;
features
=
new
LinkedList
<>();
long
value
=
time
/
2
;
features
.
add
(
new
FreudFeature
(
value
));
featureList
=
new
LinkedList
<>();
featureList
.
add
(
new
FreudFeature
(
featureVal
));
}
public
int
getUidR
()
{
...
...
@@ -62,8 +62,8 @@ public class Sample {
return
numOfFeatures
;
}
public
List
<
FreudFeature
>
getFeature
s
()
{
return
feature
s
;
public
List
<
FreudFeature
>
getFeature
List
()
{
return
feature
List
;
}
public
int
getNumOfBranches
()
{
...
...
src/main/java/TestClassToSerialize.java
View file @
abb01f02
import
java.io.
Serializable
;
import
java.io.
*
;
import
java.util.ArrayList
;
import
java.util.LinkedList
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
public
class
TestClassToSerialize
implements
Serializable
{
String
instrumentationDir
=
"/home/nicolaamadio/Documents/tesi/freud-java-instrumentation/"
;
// FILE NAME
private
int
symbolNameLen
;
private
String
symbolName
;
...
...
@@ -17,39 +22,51 @@ public class TestClassToSerialize implements Serializable {
List
<
Sample
>
sampleList
;
/* CONSTRUCTOR */
public
TestClassToSerialize
(
String
symbolName
,
int
samplesCount
)
{
public
TestClassToSerialize
(
String
symbolName
)
throws
IOException
{
this
.
symbolNameLen
=
symbolName
.
length
();
this
.
symbolName
=
symbolName
;
// feature names
this
.
featureNamesCount
=
1
;
String
myVar
=
"my
var"
;
String
myVar
=
"
_
my
_
var"
;
featureNames
=
new
LinkedList
<>();
featureNames
.
add
(
new
FreudFeatureName
((
short
)
myVar
.
length
(),
myVar
));
this
.
typeNamesCount
=
0
;
this
.
samplesCount
=
samplesCount
;
this
.
sampleList
=
new
ArrayList
<>();
BufferedReader
logsReader
=
new
BufferedReader
(
new
FileReader
(
instrumentationDir
+
"param-logs.txt"
));
this
.
samplesCount
=
Integer
.
parseInt
(
logsReader
.
readLine
());
Long
[]
featureArray
=
new
Long
[
samplesCount
];
String
feature
=
logsReader
.
readLine
();
for
(
int
i
=
0
;
i
<
samplesCount
;
i
++)
{
sampleList
.
add
(
new
Sample
(
i
));
featureArray
[
i
]
=
Long
.
valueOf
(
feature
);
feature
=
logsReader
.
readLine
();
}
logsReader
.
close
();
this
.
sampleList
=
new
ArrayList
<>();
BufferedReader
tsReader
=
new
BufferedReader
(
new
FileReader
(
instrumentationDir
+
"time-logs.txt"
));
String
line
=
tsReader
.
readLine
();
int
i
=
0
;
while
(
line
!=
null
)
{
sampleList
.
add
(
new
Sample
(
featureArray
[
i
],
Long
.
parseLong
(
line
)));
line
=
tsReader
.
readLine
();
i
++;
}
assertEquals
(
i
,
samplesCount
);
tsReader
.
close
();
}
/* GETTERS & SETTERS */
// FILE NAME
public
void
setSymbolNameLen
(
int
symbolNameLen
)
{
this
.
symbolNameLen
=
symbolNameLen
;
}
public
int
getSymbolNameLen
()
{
return
symbolNameLen
;
}
public
void
setSymbolName
(
String
symbolName
)
{
this
.
symbolName
=
symbolName
;
}
public
String
getSymbolName
()
{
return
symbolName
;
}
...
...
@@ -59,10 +76,6 @@ public class TestClassToSerialize implements Serializable {
return
featureNamesCount
;
}
public
void
setFeatureNamesCount
(
int
featureNamesCount
)
{
this
.
featureNamesCount
=
featureNamesCount
;
}
public
List
<
FreudFeatureName
>
getFeatureNamesList
()
{
return
featureNames
;
}
...
...
@@ -72,25 +85,13 @@ public class TestClassToSerialize implements Serializable {
return
typeNamesCount
;
}
public
void
setTypeNamesCount
(
int
typeNamesCount
)
{
this
.
typeNamesCount
=
typeNamesCount
;
}
// SAMPLES
public
int
getSamplesCount
()
{
return
samplesCount
;
}
public
void
setSamplesCount
(
int
samplesCount
)
{
this
.
samplesCount
=
samplesCount
;
}
public
List
<
Sample
>
getSampleList
()
{
return
sampleList
;
}
public
void
setSampleList
(
ArrayList
<
Sample
>
sampleList
)
{
this
.
sampleList
=
sampleList
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment