public static ProfiledBasicInfo build(ExporterConfig config, ModuleManager manager) throws IOException {
        ProfiledBasicInfo data = new ProfiledBasicInfo();
        data.setConfig(config);

        ProfileTaskQueryService taskQueryService = manager.find(CoreModule.NAME).provider().getService(ProfileTaskQueryService.class);
        TraceQueryService traceQueryService = manager.find(CoreModule.NAME).provider().getService(TraceQueryService.class);
        IProfileThreadSnapshotQueryDAO threadSnapshotQueryDAO = manager.find(StorageModule.NAME).provider().getService(IProfileThreadSnapshotQueryDAO.class);

        // query and found profiled segment
        List<SegmentRecord> taskTraces = taskQueryService.getTaskSegments(config.getTaskId());
        List<SegmentRecord> segments = taskTraces.stream().filter(t -> Objects.equals(t.getTraceId(), config.getTraceId())).collect(Collectors.toList());
        if (CollectionUtils.isEmpty(segments)) {
            throw new IllegalArgumentException("Cannot fount profiled segment in current task: " + config.getTaskId()
                    + ", segment id: " + config.getTraceId() + ", current task total profiled trace count is " + taskTraces.size());
        }

        // setting segment basic info
        data.setSegments(new ArrayList<>());
        data.setProfiledSegmentSpans(new ArrayList<>());
        for (SegmentRecord segment : segments) {
            final ProfiledSegment profiledSegment = new ProfiledSegment();

            String segmentId = segment.getSegmentId();
            long startTime = segment.getStartTime();
            long endTime = startTime + segment.getLatency();
            profiledSegment.setSegmentId(segmentId);
            profiledSegment.setSegmentStartTime(startTime);
            profiledSegment.setSegmentEndTime(endTime);
            profiledSegment.setDuration(segment.getLatency());

            // query spans
            Trace trace = traceQueryService.queryTrace(config.getTraceId(), null);
            List<Span> profiledSegmentSpans = trace.getSpans().stream().filter(s -> Objects.equals(s.getSegmentId(), segmentId)).collect(Collectors.toList());
            if (CollectionUtils.isEmpty(profiledSegmentSpans)) {
                throw new IllegalArgumentException("Current segment cannot found any span");
            }
            data.getProfiledSegmentSpans().addAll(profiledSegmentSpans);

            // query snapshots sequences
            int minSequence = threadSnapshotQueryDAO.queryMinSequence(segmentId, startTime, endTime);
            int maxSequence = threadSnapshotQueryDAO.queryMaxSequence(segmentId, startTime, endTime);
            profiledSegment.setMinSequence(minSequence);
            profiledSegment.setMaxSequence(maxSequence);

            data.getSegments().add(profiledSegment);
        }

        return data;
    }
reading data from storage and build data
oap-server/server-tools/profile-exporter/tool-profile-snapshot-bootstrap/src/main/java/org/apache/skywalking/oap/server/tool/profile/exporter/ProfiledBasicInfo.java