/**
* Timeout for stop tracing command.
*/
- static int TRACING_PROCESS_STOP_TIMEOUT = 2000; // TODO measure this timeout more accurate later
+ static int TRACING_PROCESS_STOP_TIMEOUT = 8000; // TODO measure this timeout more accurate later
/**
* Map between device and last trace manager used for that device.
* {@link ErrorCode#ERR_EXCEPTION_OCCURRED} if couldn't select requested template.
*/
public synchronized ErrorCode startTrace() {
- return CliInternals.startTracing(args);
+ ErrorCode result = CliInternals.startTracing(args);
+ // Block until StartTraceManager thread starts all needed jobs
+ try {
+ DAState.waitPrepared();
+ } catch (InterruptedException e) {
+ Logger.error(e);
+ return ErrorCode.ERR_EXCEPTION_OCCURRED;
+ }
+ // If CliInternals.startTracing returns Success the StartTraceManager thread still may fail
+ if (!DAState.isRunning() && result==ErrorCode.SUCCESS)
+ result = ErrorCode.ERR_EXCEPTION_OCCURRED;
+ return result;
}
/**