Lines Matching +full:config +full:- +full:cond
1 // SPDX-License-Identifier: GPL-2.0
44 C(FUNC_TR, "function-trace"), \
45 C(DISP_GR, "display-graph"), \
193 pthread_cond_t cond;
226 pthread_cond_t cond;
271 count -= r;
339 static __always_inline void cond_signal(pthread_cond_t *cond)
341 errno = pthread_cond_signal(cond);
346 static __always_inline void cond_wait(pthread_cond_t *restrict cond,
349 errno = pthread_cond_wait(cond, mutex);
354 static __always_inline void cond_broadcast(pthread_cond_t *cond)
356 errno = pthread_cond_broadcast(cond);
414 static __always_inline void cond_init(pthread_cond_t *cond,
417 errno = pthread_cond_init(cond, attr);
423 cond_timedwait(pthread_cond_t *restrict cond,
427 errno = pthread_cond_timedwait(cond, mutex, abstime);
445 cond_init(&printstate.cond, &cattr);
519 future->tv_sec += time_us / USEC_PER_SEC;
520 nsec = future->tv_nsec + (time_us * NSEC_PER_USEC) % NSEC_PER_SEC;
522 future->tv_nsec = nsec % NSEC_PER_SEC;
523 future->tv_sec += 1;
532 if (now.tv_sec > time->tv_sec)
534 if (now.tv_sec < time->tv_sec)
536 return (now.tv_nsec >= time->tv_nsec);
560 if (state->opt_valid[i] && state->opt[i] != cur[i]) {
561 r = set_trace_opt(optstr[i], state->opt[i]);
564 optstr[i], bool2str(state->opt[i]));
568 bool2str(state->opt[i]));
588 if (r && r[psize - 1] == '\n')
589 r[psize - 1] = '\0';
666 req->ticket = r;
667 req->ticket_completed_ref = printstate.ticket_completed;
668 cond_broadcast(&printstate.cond);
675 if (req->ticket > printstate.ticket_completed)
676 printstate.ticket_completed = req->ticket;
682 return (printstate.ticket_counter != req->ticket);
700 value = --printstate.cnt;
718 return (printstate.ticket_completed != req->ticket_completed_ref);
726 msg->len = 0;
728 bytes = snprintf(msg->buf, sizeof(msg->buf),
731 bytes = snprintf(msg->buf, sizeof(msg->buf),
736 msg->len = bytes;
746 sleeptable.table = &probabilities[PROB_TABLE_MAX_SIZE - size];
756 j--;
764 int diff = req->ticket - req->ticket_completed_ref;
767 msg->len = 0;
768 diff--;
776 if (diff >= (sleeptable.size - 1)) {
777 rval = sleeptable.table[sleeptable.size - 1];
789 q->next_prod_idx = 0;
790 q->next_cons_idx = 0;
791 mutex_init(&q->mutex, NULL);
792 errno = pthread_cond_init(&q->cond, NULL);
799 if (q->next_prod_idx >= q->next_cons_idx)
800 return q->next_prod_idx - q->next_cons_idx;
802 return QUEUE_SIZE - q->next_cons_idx + q->next_prod_idx;
807 int nr_free = QUEUE_SIZE - queue_len(q);
826 q->entries[q->next_prod_idx] = *e;
827 queue_idx_inc(&q->next_prod_idx);
832 struct entry e = q->entries[q->next_cons_idx];
834 queue_idx_inc(&q->next_cons_idx);
840 cond_signal(&q->cond);
845 cond_wait(&q->cond, &q->mutex);
853 mutex_lock(&q->mutex);
856 cond_signal(&q->cond);
858 r = -1;
859 mutex_unlock(&q->mutex);
867 mutex_lock(&q->mutex);
875 mutex_unlock(&q->mutex);
884 while (p->name != NULL) {
885 if (!strcmp(name, p->name))
897 while (p->name != NULL) {
898 if (p->policy == policy)
899 return p->name;
1018 cond_timedwait(&printstate.cond, &printstate.mutex, &future);
1024 delay = -1;
1082 sec = timestamp->tv_sec;
1083 us = timestamp->tv_nsec / 1000;
1085 if (resize_msg != NULL && resize_msg->len > 0) {
1086 strncpy(p, resize_msg->buf, resize_msg->len);
1087 bytes += resize_msg->len;
1088 p += resize_msg->len;
1089 bufspace -= resize_msg->len;
1095 sec, us, req->ticket, str);
1098 sec, us, req->ticket);
1142 bufspace = bufspace - reserve - 1;
1144 if (resize_msg != NULL && resize_msg->len > 0) {
1145 bytes = resize_msg->len;
1146 strncpy(p, resize_msg->buf, bytes);
1149 bufspace -= bytes;
1159 sec = timestamp->tv_sec;
1160 us = timestamp->tv_nsec / 1000;
1166 sec, us, req->ticket, slept_ms);
1170 us, req->ticket);
1178 bufspace -= bytes;
1191 bufspace -= bytes;
1207 bufspace -= bytes;
1334 state->opt[i] = get_trace_opt(allopt, optstr[i],
1335 &state->opt_valid[i]);
1393 "Use the -F [--force] option to disregard the current tracer.\n", tracer);
1420 if (state->opt_valid[i] &&
1421 state->opt[i] != new[i]) {
1513 if ((event->mask & IN_MODIFY) != 0)
1515 p += istructsize + event->len;
1544 modified--;
1680 "-l, --list\t\tList the latency tracers that are supported by the\n"
1683 "\t\t\tchange your kernel config and build a new kernel.\n\n"
1685 "-t, --tracer TR\t\tUse the tracer TR. The default is to use the first\n"
1698 "-F, --force\t\tProceed even if another ftrace tracer is active. Without\n"
1702 "-s, --threshold TH\tConfigure ftrace to use a threshold of TH microseconds\n"
1708 "-f, --function\t\tEnable the function-trace option in trace_options. With\n"
1713 "-g, --graph\t\tEnable the display-graph option in trace_option. This\n"
1717 "-c, --policy POL\tRun the program with scheduling policy POL. POL can be\n"
1722 "-p, --priority PRI\tRun the program with priority PRI. The acceptable range\n"
1725 "-n, --notrace\t\tIf latency is detected, do not print out the content of\n"
1728 "-t, --threads NRTHR\tRun NRTHR threads for printing. Default is %d.\n\n"
1730 "-r, --random\t\tArbitrarily sleep a certain amount of time, default\n"
1739 "-a, --nrlat NRLAT\tFor the purpose of arbitrary delay, assume that there\n"
1744 "\t\t\timplies -r. We need to know this number in order to\n"
1748 "\t\t\t1/NRLAT 1/(NRLAT - 1) ... 1/3 1/2 1\n\n"
1750 "\t\t\t1 - P, where P is from the series above\n\n"
1763 "-v, --verbose\t\tIncrease the verbosity. If this option is given once,\n"
1770 "-u, --time TIME\t\tArbitrarily sleep for a specified time TIME ms before\n"
1772 "\t\t\tis %ld ms. This option implies -r.\n\n"
1774 "-x, --no-ftrace\t\tDo not configure ftrace. This assume that the user\n"
1778 "-i, --tracefile FILE\tUse FILE as trace file. The default is\n"
1780 "\t\t\tThis options implies -x\n\n"
1782 "-m, --max-lat FILE\tUse FILE as tracing_max_latency file. The default is\n"
1784 "\t\t\tThis options implies -x\n\n"
1846 { "no-ftrace", no_argument, 0, 'x' },
1848 { "max-lat", required_argument, 0, 'm' },
1865 if (c == -1)
1890 check_alldigits(optarg, "-s [--threshold]");
1902 sched_policy = p->policy;
1905 sched_pri = p->default_pri;
1915 check_alldigits(optarg, "-p [--priority]");
1928 check_alldigits(optarg, "-e [--threads]");
1939 check_alldigits(optarg, "-u [--time]");
1958 check_alldigits(optarg, "-a [--nrlat]");