/* * cmdman_prints.c * * Copyright (c) 2009 Ismael Gomez-Miguelez, UPC . All rights reserved. * * This file is part of ALOE. * * ALOE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ALOE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ALOE. If not, see . * */ #include #include #include #include #include "phal_hw_api.h" #include "cmdman_backend.h" char pstr[2048]; void print_to_fd(int fd, char *str) { write(fd,str,strlen(str)+1); } /** Print processes list * * Prints processes to file descriptor as parameter * (set to 1 for stdout) * */ int proc_print(int fd, struct proc_info *procs, int nof_procs) { int i,n; char *t,*t2,*t3,*t4,*t5; int totalcpu=0,meanperiod=0,maxcpu=0,totalfaults=0; float totalvar=0; sprintf(pstr, "\nPE\tName\t\tPeriod\tTs\tRelinq\tMean (Var) CPU\tm/v\tMAX CPU\t\t%% CPU\t%% MAX\tMAX MAC\tRT FAULTS\n"); print_to_fd(fd, pstr); n=strlen(pstr)-3+6*8; for (i=0;i\tPE:ItfId\tintBW\tintBW'\n"); print_to_fd(fd, pstr); n=strlen(pstr)-3+6*8; for (i=0;i\t0x%x:0x%x\t%.2f\t%.2f\n", pe[i].xitf[j].remote_pe,pe[i].xitf[j].xitf.id, pe[i].id,pe[i].xitf[j].remote_id, pe[i].xitf[j].xitf.BW, pe[i].xitf[j].totalBW); print_to_fd(fd, pstr); } } for (i=0;i=8) { t2="\t"; } else { t2="\t\t"; } if (strlen(stats[i].statname)>=8) { t3="\t"; } else { t3="\t\t"; } sprintf(pstr, "%s%s%s%s%d\t%d\n", stats[i].objname,t2, stats[i].statname,t3, stats[i].size, stats[i].type); print_to_fd(fd, pstr); } for (i=0;i