|
@@ -22,19 +22,21 @@ public class Analyzer {
|
|
public static final int roundLength = 1800;
|
|
public static final int roundLength = 1800;
|
|
public static final int clientNo = 1000000;
|
|
public static final int clientNo = 1000000;
|
|
|
|
|
|
|
|
+ public static final String datasetName = "reddit"; //;
|
|
|
|
+
|
|
public static final boolean coverTraffic = false;
|
|
public static final boolean coverTraffic = false;
|
|
public static final int delay = 0;
|
|
public static final int delay = 0;
|
|
- public static final String childPath = coverTraffic ? "ct" : delay > 0 ? "delay" : roundLength + "";
|
|
|
|
- public static final String logType = "random_"; //"top-" "random_"
|
|
|
|
- //public static final String logPath = "C:\\Users\\Admin\\Desktop\\Skripts\\Thesis\\Repo\\local\\vm-mount\\logs\\" + logType + clientNo + "\\" + roundLength;
|
|
|
|
- public static final String logPath = "C:\\Users\\Admin\\Desktop\\Skripts\\Thesis\\Repo\\local\\vm-mount\\logs\\" + logType + clientNo + "\\" + childPath;
|
|
|
|
- public static String clientLogPath = logPath + "\\clogs.txt";
|
|
|
|
- public static String serverLogPath = logPath + "\\slogs.txt";
|
|
|
|
|
|
+
|
|
|
|
+ public static String childPath = "";
|
|
|
|
+ public static String logType = ""; //"top-" "random_"
|
|
|
|
+ public static String logPath = "";
|
|
|
|
+ public static String clientLogPath = "";
|
|
|
|
+ public static String serverLogPath = "";
|
|
|
|
|
|
//TEST
|
|
//TEST
|
|
//private static final User toTraceUser = new User(306637085);
|
|
//private static final User toTraceUser = new User(306637085);
|
|
private static final String toTraceHashtag = "InstantFollowBack";
|
|
private static final String toTraceHashtag = "InstantFollowBack";
|
|
- private static final String intersectingClientID = "client-1034";
|
|
|
|
|
|
+ private static final String intersectingClientID = "client-937851";
|
|
private static final long targetUserID = 398449825L;
|
|
private static final long targetUserID = 398449825L;
|
|
|
|
|
|
|
|
|
|
@@ -45,6 +47,7 @@ public class Analyzer {
|
|
}
|
|
}
|
|
|
|
|
|
public Analyzer () throws InterruptedException {
|
|
public Analyzer () throws InterruptedException {
|
|
|
|
+ pathConfig();
|
|
Thread slogs = new Thread(() -> {
|
|
Thread slogs = new Thread(() -> {
|
|
try {
|
|
try {
|
|
ServerLogParser.run();
|
|
ServerLogParser.run();
|
|
@@ -63,6 +66,20 @@ public class Analyzer {
|
|
//new ServerLogParser(serverLogPath).traceUser();
|
|
//new ServerLogParser(serverLogPath).traceUser();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private static void pathConfig() {
|
|
|
|
+ childPath = coverTraffic ? "ct" + "\\" + coverTraffic : delay > 0 ? "delay" + "\\" + delay : roundLength + "";
|
|
|
|
+ if(datasetName.equals("twitter")) {
|
|
|
|
+ logType = "twitter\\random_";
|
|
|
|
+ logPath = "C:\\Users\\Admin\\Desktop\\Skripts\\Thesis\\Repo\\local\\vm-mount\\logs\\" + logType + clientNo + "\\" + childPath;
|
|
|
|
+ }
|
|
|
|
+ else if(datasetName.equals("reddit")) {
|
|
|
|
+ logType = "reddit\\";
|
|
|
|
+ logPath = "C:\\Users\\Admin\\Desktop\\Skripts\\Thesis\\Repo\\local\\vm-mount\\logs\\" + logType + "\\" + "ct\\0\\";
|
|
|
|
+ }
|
|
|
|
+ clientLogPath = logPath + "\\clogs.txt";
|
|
|
|
+ serverLogPath = logPath + "\\slogs.txt";
|
|
|
|
+ }
|
|
|
|
+
|
|
private static void traceClientUserLink() throws InterruptedException, ExecutionException {
|
|
private static void traceClientUserLink() throws InterruptedException, ExecutionException {
|
|
Analyzer privateInst = new Analyzer();
|
|
Analyzer privateInst = new Analyzer();
|
|
int roundNum = privateInst.intersectUsers(ClientLogParser.clients.get(intersectingClientID), 1, true);
|
|
int roundNum = privateInst.intersectUsers(ClientLogParser.clients.get(intersectingClientID), 1, true);
|
|
@@ -78,9 +95,9 @@ public class Analyzer {
|
|
System.out.println();
|
|
System.out.println();
|
|
List<Map.Entry<Hashtag, Integer>> results = privateInst.calculatePointsGivenHashtags(ClientLogParser.clients.get(intersectingClientID), hashtags, 1, true);
|
|
List<Map.Entry<Hashtag, Integer>> results = privateInst.calculatePointsGivenHashtags(ClientLogParser.clients.get(intersectingClientID), hashtags, 1, true);
|
|
System.out.println("Result size: " + results.size());
|
|
System.out.println("Result size: " + results.size());
|
|
- User targetUser = ServerLogParser.users.get(targetUserID);
|
|
|
|
- System.out.println();
|
|
|
|
- targetUser.getHashtags().forEach((k, v) -> System.out.println(k.getName()));
|
|
|
|
|
|
+ //User targetUser = ServerLogParser.users.get(targetUserID);
|
|
|
|
+ //System.out.println();
|
|
|
|
+ //targetUser.getHashtags().forEach((k, v) -> System.out.println(k.getName()));
|
|
}
|
|
}
|
|
|
|
|
|
public void traceHashtag() throws InterruptedException, ExecutionException {
|
|
public void traceHashtag() throws InterruptedException, ExecutionException {
|
|
@@ -241,7 +258,10 @@ public class Analyzer {
|
|
Map<String, Integer> results = new Hashtable<>();
|
|
Map<String, Integer> results = new Hashtable<>();
|
|
|
|
|
|
List<Round> targetRounds = new ArrayList<>(targetClient.getRounds().keySet());
|
|
List<Round> targetRounds = new ArrayList<>(targetClient.getRounds().keySet());
|
|
|
|
+ targetRounds.sort(Comparator.comparingInt(Round::getNo));
|
|
int targetNoRounds = targetRounds.size();
|
|
int targetNoRounds = targetRounds.size();
|
|
|
|
+ int lastRound = 1;
|
|
|
|
+ long lastResult = ServerLogParser.hashtags.size();
|
|
for(int i = 0; i < targetNoRounds; i++) {
|
|
for(int i = 0; i < targetNoRounds; i++) {
|
|
results.forEach((k, v) -> results.replace(k, v - 1));
|
|
results.forEach((k, v) -> results.replace(k, v - 1));
|
|
//results.entrySet().removeIf(e -> (e.getValue() < 0));
|
|
//results.entrySet().removeIf(e -> (e.getValue() < 0));
|
|
@@ -254,7 +274,16 @@ public class Analyzer {
|
|
else
|
|
else
|
|
results.put(hashtag.getName(), -(i + 1) + 1);
|
|
results.put(hashtag.getName(), -(i + 1) + 1);
|
|
}
|
|
}
|
|
|
|
+ //long resultSize = Collections.frequency(results.values(), Collections.max(results.values(), Integer::compare));
|
|
|
|
+
|
|
|
|
+ //for (int x = lastRound + 1; x < targetRoundNo; x++) {
|
|
|
|
+ // System.out.print(lastResult+ ",");
|
|
|
|
+ //}
|
|
|
|
+ //lastRound = targetRoundNo;
|
|
|
|
+ //lastResult = resultSize;
|
|
|
|
+ //System.out.print(resultSize + ",");
|
|
}
|
|
}
|
|
|
|
+ //System.out.println();
|
|
//results.entrySet().removeIf(e -> (e.getValue() < targetNoRound /2));
|
|
//results.entrySet().removeIf(e -> (e.getValue() < targetNoRound /2));
|
|
List<Map.Entry<String, Integer>> sortedList = new ArrayList<>(results.entrySet());
|
|
List<Map.Entry<String, Integer>> sortedList = new ArrayList<>(results.entrySet());
|
|
sortedList.sort(Map.Entry.comparingByValue((v1, v2) -> Integer.compare(v2, v1)));
|
|
sortedList.sort(Map.Entry.comparingByValue((v1, v2) -> Integer.compare(v2, v1)));
|
|
@@ -305,16 +334,18 @@ public class Analyzer {
|
|
List<Round> roundList = new ArrayList<>(ServerLogParser.rounds.values());
|
|
List<Round> roundList = new ArrayList<>(ServerLogParser.rounds.values());
|
|
roundList.sort(Comparator.comparingInt(Round::getNo));
|
|
roundList.sort(Comparator.comparingInt(Round::getNo));
|
|
for(Round r: roundList) {
|
|
for(Round r: roundList) {
|
|
- if(targetClient.getRounds().containsKey(r)) {
|
|
|
|
- userList.removeIf(u -> !u.getRounds().containsKey(r) || !u.getRounds().get(r).equals(targetClient.getRounds().get(r)));
|
|
|
|
- } else {
|
|
|
|
|
|
+ if(!targetClient.getRounds().containsKey(r)) {
|
|
userList.removeIf(u -> u.getRounds().containsKey(r));
|
|
userList.removeIf(u -> u.getRounds().containsKey(r));
|
|
|
|
+ } else {
|
|
|
|
+ userList.removeIf(u -> !u.getRounds().containsKey(r) || !u.getRounds().get(r).equals(targetClient.getRounds().get(r)));
|
|
}
|
|
}
|
|
|
|
+ //System.out.print(userList.size() + ", ");
|
|
if(userList.size() <= 1) {
|
|
if(userList.size() <= 1) {
|
|
roundProcessed = r.getNo();
|
|
roundProcessed = r.getNo();
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //System.out.println();
|
|
if(userList.size() != 1) {
|
|
if(userList.size() != 1) {
|
|
roundProcessed = -1;
|
|
roundProcessed = -1;
|
|
}
|
|
}
|
|
@@ -362,6 +393,10 @@ public class Analyzer {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
|
|
+ calculatePoint();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void calculatePoint() {
|
|
Map<Round, Integer> clone = new Hashtable<>(client.getRounds());
|
|
Map<Round, Integer> clone = new Hashtable<>(client.getRounds());
|
|
AtomicInteger n = new AtomicInteger();
|
|
AtomicInteger n = new AtomicInteger();
|
|
clone.keySet().retainAll(this.hashtag.getRoundMap().keySet());
|
|
clone.keySet().retainAll(this.hashtag.getRoundMap().keySet());
|
|
@@ -372,4 +407,4 @@ public class Analyzer {
|
|
hashtagMap.put(this.hashtag, n.get());
|
|
hashtagMap.put(this.hashtag, n.get());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|