Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions affinity/src/main/c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ JNI_JAVA_SOURCES := $(patsubst %,$(TARGET_DIR)/%.class,$(subst .,/,$(JAVA_CLASSE
JAVA_BUILD_DIR := $(TARGET_DIR)

JAVA_HOME ?= /usr/java/default
#JAVA_HOME :=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home
#JAVA_HOME :=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home
JAVA_LIB := $(JAVA_HOME)/jre/lib
JVM_SHARED_LIBS := -L$(JAVA_LIB)/amd64/server -L$(JAVA_LIB)/i386/server -L$(JAVA_LIB)/amd64/jrockit/ -L$(JAVA_LIB)/i386/jrockit/ -L$(JAVA_LIB)/ppc64le/server -L$(JAVA_LIB)/ppc64le/jrockit/

CXX=g++
INCLUDES := -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/linux -I $(WORKING_DIR)
INCLUDES := -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/linux -I $(WORKING_DIR) -I $(JAVA_HOME)/include/darwin

# classpath for javah
ifdef CLASSPATH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
* Data generator for benchmarks, this class contains all common methods and attributes that can be used in each application
*/
Expand Down Expand Up @@ -45,5 +47,8 @@ public void clearDataStructures() {
}
/* Switch configuration, used in the dynamic data generator*/

public List<String> getTranToDecisionConf() {
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class GSTPGDataGenerator extends DataGenerator {
private final int State_Access_Skewness; // ratio of state access, following zipf distribution
private final int Ratio_of_Transaction_Aborts; // ratio of transaction aborts, fail the transaction or not. i.e. transfer amount might be invalid.
private final int Ratio_of_Overlapped_Keys; // ratio of overlapped keys in transactions, which affects the dependencies and circulars.
private final int Ratio_of_Multiple_State_Access_Ratio;//ratio of multiple state access per transaction
private final int Transaction_Length;
// control the number of txns overlap with each other.
private final ArrayList<Integer> generatedKeys = new ArrayList<>();
Expand Down Expand Up @@ -66,6 +67,7 @@ public GSTPGDataGenerator(GSTPGDataGeneratorConfig dataConfig) {
Ratio_of_Transaction_Aborts = dataConfig.Ratio_of_Transaction_Aborts;
Ratio_of_Overlapped_Keys = dataConfig.Ratio_of_Overlapped_Keys;
Transaction_Length = dataConfig.Transaction_Length;
Ratio_of_Multiple_State_Access_Ratio = dataConfig.Ratio_of_Multiple_State_Access_Ratio;

int nKeyState = dataConfig.getnKeyStates();

Expand Down Expand Up @@ -104,6 +106,12 @@ protected void generateTuple() {
}

private GSEvent randomEvent() {
int NUM_ACCESS;
if (random.nextInt(100) < Ratio_of_Multiple_State_Access_Ratio) {
NUM_ACCESS = this.NUM_ACCESS;
} else {
NUM_ACCESS = 1;
}
int[] keys = new int[NUM_ACCESS*Transaction_Length];
int writeLevel = -1;
if (!isUnique) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class GSTPGDataGeneratorConfig extends DataGeneratorConfig {
public int Ratio_of_Overlapped_Keys;
public int Ratio_of_Transaction_Aborts;
public int Transaction_Length;
public int Ratio_of_Multiple_State_Access_Ratio;

@Override
public void initialize(Configuration config) {
Expand All @@ -25,5 +26,6 @@ public void initialize(Configuration config) {
Ratio_of_Overlapped_Keys = config.getInt("Ratio_of_Overlapped_Keys", 0);
Ratio_of_Transaction_Aborts = config.getInt("Ratio_of_Transaction_Aborts", 0);
Transaction_Length = config.getInt("Transaction_Length", 1);
Ratio_of_Multiple_State_Access_Ratio = config.getInt("Ratio_of_Multiple_State_Access_Ratio",100);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public class GSTPGDynamicDataGenerator extends DynamicWorkloadGenerator {
private int Ratio_of_Transaction_Aborts; // ratio of transaction aborts, fail the transaction or not. i.e. transfer amount might be invalid.
private int Ratio_of_Overlapped_Keys; // ratio of overlapped keys in transactions, which affects the dependencies and circulars.
private int Transaction_Length;
private int Ratio_of_Multiple_State_Access_Ratio;//ratio of multiple state access per transaction
private int tthread;
private int nKeyState;
// control the number of txns overlap with each other.
private ArrayList<Integer> generatedKeys = new ArrayList<>();
// independent transactions.
Expand All @@ -49,21 +51,78 @@ public GSTPGDynamicDataGenerator(DynamicDataGeneratorConfig dynamicDataConfig) {
}

@Override
public void switchConfiguration() {
State_Access_Skewness = dynamicDataConfig.State_Access_Skewness;
NUM_ACCESS = dynamicDataConfig.NUM_ACCESS;
Ratio_of_Transaction_Aborts = dynamicDataConfig.Ratio_of_Transaction_Aborts;
Ratio_of_Overlapped_Keys = dynamicDataConfig.Ratio_of_Overlapped_Keys;
Transaction_Length = dynamicDataConfig.Transaction_Length;

int nKeyState = dynamicDataConfig.getnKeyStates();
int MAX_LEVEL = 256;
for (int i = 0; i < nKeyState; i++) {
idToLevel.put(i, i% MAX_LEVEL);
public void tranToDecisionConf() {
//TD,LD,PD,VDD,R_of_A,isCD,isCC,
StringBuilder stringBuilder = new StringBuilder();
//TODO:hard code, function not sure
double td = Transaction_Length * dynamicDataConfig.getCheckpoint_interval();
td = td *((double) Ratio_of_Overlapped_Keys/100);
stringBuilder.append(td);
stringBuilder.append(",");
double ld = Transaction_Length * dynamicDataConfig.getCheckpoint_interval();
stringBuilder.append(ld);
stringBuilder.append(",");
double pd = Transaction_Length * dynamicDataConfig.getCheckpoint_interval() * ((double) Ratio_of_Overlapped_Keys/100) * NUM_ACCESS;
stringBuilder.append(pd);
stringBuilder.append(",");
stringBuilder.append((double) State_Access_Skewness/100);
stringBuilder.append(",");
stringBuilder.append((double) Ratio_of_Transaction_Aborts/10000);
stringBuilder.append(",");
if (AppConfig.isCyclic) {
stringBuilder.append("1,");
} else {
stringBuilder.append("0,");
}
if (AppConfig.complexity < 40000){
stringBuilder.append("0,");
} else {
stringBuilder.append("1,");
}
stringBuilder.append(eventID+dynamicDataConfig.getShiftRate()*dynamicDataConfig.getCheckpoint_interval()*dynamicDataConfig.getTotalThreads());
this.tranToDecisionConf.add(stringBuilder.toString());
}

@Override
public void switchConfiguration(String type) {
switch (type) {
case "default" :
State_Access_Skewness = dynamicDataConfig.State_Access_Skewness;
NUM_ACCESS = dynamicDataConfig.NUM_ACCESS;
Ratio_of_Transaction_Aborts = dynamicDataConfig.Ratio_of_Transaction_Aborts;
Ratio_of_Overlapped_Keys = dynamicDataConfig.Ratio_of_Overlapped_Keys;
Transaction_Length = dynamicDataConfig.Transaction_Length;
Ratio_of_Multiple_State_Access_Ratio = dynamicDataConfig.Ratio_of_Multiple_State_Access_Ratio;

nKeyState = dynamicDataConfig.getnKeyStates();
int MAX_LEVEL = 256;
for (int i = 0; i < nKeyState; i++) {
idToLevel.put(i, i% MAX_LEVEL);
}
keyZipf = new FastZipfGenerator(nKeyState, (double) State_Access_Skewness / 100, 0, 12345678);
configure_store(1, (double) State_Access_Skewness / 100, dynamicDataConfig.getTotalThreads(), nKeyState);
p_generator = new FastZipfGenerator(nKeyState, (double) State_Access_Skewness / 100, 0);
break;
case "LD" :
Transaction_Length = dynamicDataConfig.Transaction_Length;
break;
case "isCyclic" :
Ratio_of_Transaction_Aborts = dynamicDataConfig.Ratio_of_Transaction_Aborts;
State_Access_Skewness = dynamicDataConfig.State_Access_Skewness;
keyZipf = new FastZipfGenerator(nKeyState, (double) State_Access_Skewness / 100, 0, 12345678);
configure_store(1, (double) State_Access_Skewness / 100, dynamicDataConfig.getTotalThreads(), nKeyState);
p_generator = new FastZipfGenerator(nKeyState, (double) State_Access_Skewness / 100, 0);
AppConfig.isCyclic = true;
break;
case "complexity" :
AppConfig.complexity = 80000;
break;
case "unchanging" :
break;
default:
throw new IllegalStateException("Unexpected value: " + type);
}
keyZipf = new FastZipfGenerator(nKeyState, (double) State_Access_Skewness / 100, 0, 12345678);
configure_store(1, (double) State_Access_Skewness / 100, dynamicDataConfig.getTotalThreads(), nKeyState);
p_generator = new FastZipfGenerator(nKeyState, (double) State_Access_Skewness / 100, 0);
tranToDecisionConf();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class OBTPGDynamicDataGenerator extends DynamicWorkloadGenerator {
private int Transaction_Length;
private int tthread;
private int Ratio_of_Buying;
private int nKeyState;
// control the number of txns overlap with each other.
private ArrayList<Integer> generatedKeys = new ArrayList<>();
// independent transactions.
Expand Down Expand Up @@ -67,24 +68,77 @@ protected void generateTuple() {
}
events.add(event);
}
@Override
public void tranToDecisionConf() {
//TD,LD,PD,VDD,R_of_A,isCD,isCC,
StringBuilder stringBuilder = new StringBuilder();
//TODO:hard code, function not sure
double td = Transaction_Length * dynamicDataConfig.getCheckpoint_interval() * (1 - (double)Ratio_of_Buying/100) +
((double)Ratio_of_Buying/100) * 1 * dynamicDataConfig.getCheckpoint_interval();
td = td *((double) Ratio_of_Overlapped_Keys/100);
stringBuilder.append(td);
stringBuilder.append(",");
double ld = Transaction_Length * dynamicDataConfig.getCheckpoint_interval() * (1 - (double)Ratio_of_Buying/100) +
((double)Ratio_of_Buying/100) * 1 * dynamicDataConfig.getCheckpoint_interval();
stringBuilder.append(ld);
stringBuilder.append(",");
double pd = 0;
stringBuilder.append(pd);
stringBuilder.append(",");
stringBuilder.append((double) State_Access_Skewness/100);
stringBuilder.append(",");
stringBuilder.append((double) Ratio_of_Transaction_Aborts/10000);
stringBuilder.append(",");
if (AppConfig.isCyclic) {
stringBuilder.append("1,");
} else {
stringBuilder.append("0,");
}
if (AppConfig.complexity < 40000){
stringBuilder.append("0,");
} else {
stringBuilder.append("1,");
}
stringBuilder.append(eventID+dynamicDataConfig.getShiftRate()*dynamicDataConfig.getCheckpoint_interval()*dynamicDataConfig.getTotalThreads());
this.tranToDecisionConf.add(stringBuilder.toString());
}

@Override
public void switchConfiguration() {
State_Access_Skewness = dynamicDataConfig.State_Access_Skewness;
NUM_ACCESS = dynamicDataConfig.NUM_ACCESS;
Ratio_of_Transaction_Aborts = dynamicDataConfig.Ratio_of_Transaction_Aborts;
Ratio_of_Overlapped_Keys = dynamicDataConfig.Ratio_of_Overlapped_Keys;
Transaction_Length = dynamicDataConfig.Transaction_Length;
Ratio_of_Buying=dynamicDataConfig.Ratio_Of_Buying;
public void switchConfiguration(String type) {
switch (type){
case "default" :
State_Access_Skewness = dynamicDataConfig.State_Access_Skewness;
NUM_ACCESS = 1;
Ratio_of_Transaction_Aborts = dynamicDataConfig.Ratio_of_Transaction_Aborts;
Ratio_of_Overlapped_Keys = dynamicDataConfig.Ratio_of_Overlapped_Keys;
Transaction_Length = dynamicDataConfig.Transaction_Length;
Ratio_of_Buying=dynamicDataConfig.Ratio_Of_Buying;

int nKeyState = dynamicDataConfig.getnKeyStates();
int MAX_LEVEL = 256;
for (int i = 0; i < nKeyState; i++) {
idToLevel.put(i, i% MAX_LEVEL);
nKeyState = dynamicDataConfig.getnKeyStates();
int MAX_LEVEL = 256;
for (int i = 0; i < nKeyState; i++) {
idToLevel.put(i, i% MAX_LEVEL);
}
keyZipf = new FastZipfGenerator(nKeyState, (double) State_Access_Skewness / 100, 0, 12345678);
configure_store(1, (double) State_Access_Skewness / 100, dynamicDataConfig.getTotalThreads(), nKeyState);
p_generator = new FastZipfGenerator(nKeyState, (double) State_Access_Skewness / 100, 0);
break;
case "skew" :
State_Access_Skewness = dynamicDataConfig.State_Access_Skewness;
nKeyState = dynamicDataConfig.getnKeyStates();
keyZipf = new FastZipfGenerator(nKeyState, (double) State_Access_Skewness / 100, 0, 12345678);
configure_store(1, (double) State_Access_Skewness / 100, dynamicDataConfig.getTotalThreads(), nKeyState);
p_generator = new FastZipfGenerator(nKeyState, (double) State_Access_Skewness / 100, 0);
break;
case "abort" :
Ratio_of_Transaction_Aborts = dynamicDataConfig.Ratio_of_Transaction_Aborts;
break;
case "unchanging" :
break;
default:
throw new IllegalStateException("Unexpected value: " + type);
}
keyZipf = new FastZipfGenerator(nKeyState, (double) State_Access_Skewness / 100, 0, 12345678);
configure_store(1, (double) State_Access_Skewness / 100, dynamicDataConfig.getTotalThreads(), nKeyState);
p_generator = new FastZipfGenerator(nKeyState, (double) State_Access_Skewness / 100, 0);
tranToDecisionConf();
}

@Override
Expand Down
Loading