8 #include "flowpusher.h"
11 int main(int argc, char **argv)
13 bool total_only = false;
14 int width = 500, height = 250;
16 std::vector<flow_element> flow, total_flow;
20 mallopt(M_TRIM_THRESHOLD, -1);
22 if (argc == 2 && strcmp(argv[1], "--total-only") == 0) {
33 unsigned long long y1, y2;
35 if (scanf("%d %lf %llu %llu", &port, &x, &y1, &y2) != 4)
38 if (port != last_port) {
39 if (last_port != -1) {
41 make_graph(last_port, width, height, fp.get_min_x(), fp.get_max_x(), fp.get_min_y(), fp.get_max_y(), flow);
42 total_flow = sum_flows(total_flow, flow);
43 fprintf(stderr, "%u (%u)\n", last_port, ++num_total);
57 make_graph(last_port, width, height, fp.get_min_x(), fp.get_max_x(), fp.get_min_y(), fp.get_max_y(), flow);
58 total_flow = sum_flows(total_flow, flow);
61 unsigned long long min_y = 0;
62 unsigned long long max_y = 10000000;
64 for (unsigned i = 0; i < total_flow.size(); ++i) {
65 flow_element fe = total_flow[i];
67 min_y = std::min(min_y, fe.y1);
68 max_y = std::max(max_y, fe.y1);
70 min_y = std::min(min_y, fe.y2);
71 max_y = std::max(max_y, fe.y2);
74 make_graph(65535, width, height, total_flow[0].x, total_flow[total_flow.size() - 1].x, min_y, max_y, total_flow);