public ProfileTaskCreationResult createTask(final String serviceId,
                                                final String endpointName,
                                                final long monitorStartTime,
                                                final int monitorDuration,
                                                final int minDurationThreshold,
                                                final int dumpPeriod,
                                                final int maxSamplingCount) throws IOException {

        // calculate task execute range
        long taskStartTime = monitorStartTime > 0 ? monitorStartTime : System.currentTimeMillis();
        long taskEndTime = taskStartTime + TimeUnit.MINUTES.toMillis(monitorDuration);

        // check data
        final String errorMessage = checkDataSuccess(
            serviceId, endpointName, taskStartTime, taskEndTime, monitorDuration, minDurationThreshold, dumpPeriod,
            maxSamplingCount
        );
        if (errorMessage != null) {
            return ProfileTaskCreationResult.builder().errorReason(errorMessage).build();
        }

        // create task
        final long createTime = System.currentTimeMillis();
        final ProfileTaskRecord task = new ProfileTaskRecord();
        task.setTaskId(createTime + Const.ID_CONNECTOR + serviceId);
        task.setServiceId(serviceId);
        task.setEndpointName(endpointName.trim());
        task.setStartTime(taskStartTime);
        task.setDuration(monitorDuration);
        task.setMinDurationThreshold(minDurationThreshold);
        task.setDumpPeriod(dumpPeriod);
        task.setCreateTime(createTime);
        task.setMaxSamplingCount(maxSamplingCount);
        task.setTimeBucket(TimeBucket.getMinuteTimeBucket(taskStartTime));
        NoneStreamProcessor.getInstance().in(task);

        return ProfileTaskCreationResult.builder().id(task.id().build()).build();
    }
create new profile task

@param serviceId            monitor service id
@param endpointName         monitor endpoint name
@param monitorStartTime     create fix start time task when it's bigger 0
@param monitorDuration      monitor task duration(minute)
@param minDurationThreshold min duration threshold
@param dumpPeriod           dump period
@param maxSamplingCount     max trace count on sniffer
@return task create result
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/trace/ProfileTaskMutationService.java