+ pidit = opts.pids;
+ struct USTcmd_cmsf* cmsf = NULL;
+
+ while(*pidit != -1) {
+ switch (opts.cmd) {
+ case START_TRACE:
+ if (ustcmd_start_trace(*pidit)) {
+ fprintf(stderr,
+ "error while trying to for trace "
+ "with PID %u\n", (unsigned int) *pidit);
+ break;
+ }
+ printf("sucessfully started trace for PID %u\n",
+ (unsigned int) *pidit);
+ break;
+
+ case STOP_TRACE:
+ if (ustcmd_stop_trace(*pidit)) {
+ fprintf(stderr,
+ "error while trying to stop trace "
+ "for PID %u\n", (unsigned int) *pidit);
+ break;
+ }
+ printf("sucessfully stopped trace for PID %u\n",
+ (unsigned int) *pidit);
+ break;
+
+ case START:
+ if (ustcmd_setup_and_start(*pidit)) {
+ fprintf(stderr,
+ "error while trying to setup/start "
+ "trace for PID %u\n",
+ (unsigned int) *pidit);
+ break;
+ }
+ printf("sucessfully setup/started trace for PID %u\n",
+ (unsigned int) *pidit);
+ break;
+
+ case DESTROY:
+ if (ustcmd_destroy_trace(*pidit)) {
+ fprintf(stderr,
+ "error while trying to destroy "
+ "trace with PID %u\n",
+ (unsigned int) *pidit);
+ break;
+ }
+ printf("sucessfully destroyed trace for PID %u\n",
+ (unsigned int) *pidit);
+ break;
+
+ case LIST_MARKERS:
+ cmsf = NULL;
+ if (ustcmd_get_cmsf(&cmsf, *pidit)) {
+ fprintf(stderr,
+ "error while trying to list markers for"
+ " PID %u\n", (unsigned int) *pidit);
+ break;
+ }
+ unsigned int i = 0;
+ while (cmsf[i].channel != NULL) {
+ printf("{PID: %u, channel/marker: %s/%s, "
+ "state: %u, fs: %s}\n",
+ (unsigned int) *pidit,
+ cmsf[i].channel,
+ cmsf[i].marker,
+ cmsf[i].state,
+ cmsf[i].fs);
+ ++i;
+ }
+ ustcmd_free_cmsf(cmsf);
+ break;
+
+ case ENABLE_MARKER:
+ if (ustcmd_set_marker_state(opts.m_name, USTCMD_MS_ON,
+ *pidit)) {
+
+ fprintf(stderr,
+ "error while trying to enable marker"
+ "\"%s\" for PID %u\n",
+ opts.m_name,
+ (unsigned int) *pidit);
+ break;
+ }
+ printf("sucessfully enabled marker \"%s\" for PID %u\n",
+ opts.m_name, (unsigned int) *pidit);
+ break;
+
+ case DISABLE_MARKER:
+ if (ustcmd_set_marker_state(opts.m_name, USTCMD_MS_OFF,
+ *pidit)) {
+ fprintf(stderr,
+ "error while trying to disable marker"
+ "\"%s\" for PID %u\n",
+ opts.m_name,
+ (unsigned int) *pidit);
+ break;
+ }
+ printf("sucessfully disabled marker \"%s\" for PID %u\n",
+ opts.m_name, (unsigned int) *pidit);
+ break;
+
+ default:
+ fprintf(stderr, "error: unknown command...\n");
+ break;
+ }
+