Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused fields in split simulation #21101

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ abstract class SimulationSplit

private final AtomicInteger calls = new AtomicInteger(0);

private final long createdNanos = System.nanoTime();
private final AtomicLong completedProcessNanos = new AtomicLong();
private final AtomicLong startNanos = new AtomicLong(-1);
private final AtomicLong doneNanos = new AtomicLong(-1);
Expand All @@ -55,26 +54,11 @@ abstract class SimulationSplit
this.scheduledTimeNanos = scheduledTimeNanos;
}

long getCreatedNanos()
{
return createdNanos;
}

long getCompletedProcessNanos()
{
return completedProcessNanos.get();
}

long getStartNanos()
{
return startNanos.get();
}

long getDoneNanos()
{
return doneNanos.get();
}

long getWaitNanos()
{
return waitNanos.get();
Expand All @@ -90,16 +74,6 @@ long getScheduledTimeNanos()
return scheduledTimeNanos;
}

String getTaskId()
{
return task.getTaskId().toString();
}

SimulationTask getTask()
{
return task;
}

boolean isKilled()
{
return killed.get();
Expand All @@ -109,7 +83,6 @@ void setKilled()
{
waitNanos.addAndGet(System.nanoTime() - lastReadyTime.get());
killed.set(true);
task.setKilled();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,48 +22,29 @@

import java.util.OptionalInt;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

import static java.util.concurrent.TimeUnit.SECONDS;

abstract class SimulationTask
{
private final TaskSpecification specification;
private final TaskId taskId;

private final Set<SimulationSplit> runningSplits = Sets.newConcurrentHashSet();
private final Set<SimulationSplit> completedSplits = Sets.newConcurrentHashSet();

private final TaskHandle taskHandle;
private final AtomicBoolean killed = new AtomicBoolean();

public SimulationTask(TimeSharingTaskExecutor taskExecutor, TaskSpecification specification, TaskId taskId)
{
this.specification = specification;
this.taskId = taskId;
taskHandle = taskExecutor.addTask(taskId, () -> 0, 10, new Duration(1, SECONDS), OptionalInt.empty());
}

public void setKilled()
{
killed.set(true);
}

public boolean isKilled()
{
return killed.get();
}

public Set<SimulationSplit> getCompletedSplits()
{
return completedSplits;
}

TaskId getTaskId()
{
return taskId;
}

public TaskHandle getTaskHandle()
{
return taskHandle;
Expand Down