From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: how to make xenalyze continuously reading from xentrace file ? Date: Mon, 10 Dec 2012 14:19:09 +0000 Message-ID: <50C5EF5D.5050307@eu.citrix.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: M A , xen-devel List-Id: xen-devel@lists.xenproject.org On 08/12/12 06:02, M A wrote: > Hi There, > > I'm a student at NYIT, New York and I have project on xen hypervisor. > Currently i'm working on xentrace and xenalyze to monitor the runstate > events. What i'm trying do now is: While i'm capturing by xentrace I > want to display the result on the screen using xenalyze. I tried to use > loop in the main function but I got errors and when I tried to solve > these errors I got more errors. > > int main(int argc, char *argv[]) { > /* Start with warn at stderr. */ > > warn = stderr; > > argp_parse(&parser_def, argc, argv, 0, NULL, NULL); > > if (G.trace_file == NULL) > exit(1); > > if ( (G.fd = open(G.trace_file, O_RDONLY|O_LARGEFILE)) < 0) { > perror("open"); > error(ERR_SYSTEM, NULL); > } else { > struct stat64 s; > fstat64(G.fd, &s); > G.file_size = s.st_size; > } > > if ( (G.mh = mread_init(G.fd)) == NULL ) > perror("mread"); > > if (G.symbol_file != NULL) > parse_symbol_file(G.symbol_file); > > if(opt.dump_all) > warn = stdout; > > for (int i=0;i<=1000;i++){ > init_pcpus(); > > > if(opt.progress) > progress_init(); > > process_records(); > > if(opt.interval_mode) > interval_tail(); > > if(opt.summary) > summary(); > > if(opt.report_pcpu) > report_pcpu(); > sleep(2); > > } > if(opt.progress) > progress_finish(); > > return 0; > } > > > *Error: vcpu_next_update: FATAL: p->current not NULL! (d32768v0, > runstate running)* > > > How can I can make xenalyze to continuously read from xentrace output file ? (Adding xen-devel, since this is definitely a coding question) So I take it what you're doing is this: 1. Start xentrace: # xentrace -e all /tmp/foo.trace & 2. Running your "looping" xenalyze on it: # xenalyze -s /tmp/foo.trace Is that correct? I don't know what your exact problem is here, but one problem you'll run into eventually is that xenalyze expects a certain "finished" file format, but there's nothing here to synchronize xenalyze reading the file with xentrace writing the file. The result is that you're bound at some point to read a file of which the end is only half-written. In any case, what you're doing here is functionally not really that different from just doing it in bash: # while xenalyze -s /tmp/foo.trace && sleep 2 ; true; done -George