예제 #1
0
파일: errbars.c 프로젝트: nasa/QuIP
void pnt_bars(QSP_ARG_DECL  FILE *fp, Trial_Class *tcp)
{
        int j;
        Data_Tbl *dtp;
	float upper_bar, lower_bar;

	if( tcp == NULL ) return;

	dtp=CLASS_DATA_TBL(tcp);
	for(j=0;j<_nvals;j++){
		if( DATUM_NTOTAL(DTBL_ENTRY(dtp,j)) > 0 ){
			fprintf(fp,"%f\t", xval_array[ j ]);
			n_obs = DATUM_NTOTAL(DTBL_ENTRY(dtp,j));
			n_seen = DATUM_NCORR(DTBL_ENTRY(dtp,j));
			fprintf(fp,"%f\t",(double) n_seen / (double) n_obs );
			if( n_obs == n_seen ) upper_bar=1.0;
			else {
				if( n_seen == 0 ) alpha = (float) ALPHA;
				else alpha = (float) ALPHA/2;
				get_bar(QSP_ARG  j,u_confidence,&upper_bar);
			}
			if( n_seen == 0 ) lower_bar=0.0;
			else {
				if( n_obs == n_seen ) alpha = (float) ALPHA;
				else alpha = (float) ALPHA/2;
				get_bar(QSP_ARG  j,l_confidence,&lower_bar);
			}
			fprintf(fp,"%f\t%f\n",lower_bar,upper_bar);
		}
	}
	fclose(fp);
}
예제 #2
0
void CSimpleGraph::OnMouseMove(UINT nFlags, CPoint point)
{
	CWnd::OnMouseMove(nFlags, point);

	// Check for hover if no tip window is visible
	if (!m_tip.IsWindowVisible())
		track_mouse(TME_HOVER);
	else if (get_bar(point) != m_bar && !m_tip.FadingOut())
		m_tip.Hide(300);
}
예제 #3
0
파일: plt-main3.c 프로젝트: ChrisG0x20/gdb
void
check_bar (void)
{
  func_p bar_ptr = get_bar ();
  if (bar_ptr != bar)
    __builtin_abort ();
  if (bar_ptr() != -1)
    __builtin_abort ();
  if (bar() != -1)
    __builtin_abort ();
}
예제 #4
0
BOOL CSimpleGraph::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
	CPoint pt;
	::GetCursorPos(&pt);            // get mouse location (screen coords)
	ScreenToClient(&pt);
	if (get_bar(pt) > -1)
		::SetCursor(theApp.LoadCursor(IDC_INFO));  // show info cursor if over the graph
	else
		::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
	return TRUE;
}
예제 #5
0
LRESULT CSimpleGraph::OnMouseHover(WPARAM, LPARAM lp)
{
	CPoint pt(LOWORD(lp), HIWORD(lp));  // client window coords

	CHexEditView *pv = GetView();
	ASSERT(pv != NULL);

	m_bar = get_bar(pt);
	if (m_bar > -1 && !m_tip.IsWindowVisible())
	{
		// Update the tip info
		m_tip.Clear();
		CString ss;
		if (theApp.hex_ucase_)
			ss.Format("Byte: %d [%02.2Xh] %s", m_bar, m_bar, pv->DescChar(m_bar));
		else
			ss.Format("Byte: %d [%02.2xh] %s", m_bar, m_bar, pv->DescChar(m_bar));
		m_tip.AddString(ss);

		char buf[32];                   // used with sprintf (CString::Format can't handle __int64)
		sprintf(buf, "%I64d", m_val[m_bar]);
		ss = buf;
		AddCommas(ss);
		m_tip.AddString("Count: " +ss);

		// Work out the tip window display position and move the tip window there
		CPoint tip_pt = pt + CSize(16, 16);
		ClientToScreen(&tip_pt);
		m_tip.Move(tip_pt, false);

		m_tip.Show();
		track_mouse(TME_LEAVE);
		return 0;  // return 0 to say we processed it
	}

	return 1;
}
예제 #6
0
std::shared_ptr<Options> bar_opts() {
  return get_bar()->opts;
}
예제 #7
0
static void
do_meter(int fd, u_long option)
{
	int percent_done;
	RF_uint64 start_value;
	RF_ProgressInfo_t progressInfo;
	void *pInfoPtr;
	struct timeval start_time;
	struct timeval current_time;
	double elapsed;
	int elapsed_sec;
	int elapsed_usec;
	int simple_eta,last_eta;
	double rate;
	RF_uint64 amount;
	int tbit_value;
	char buffer[1024];
	char bar_buffer[1024];
	char eta_buffer[1024];

	if (gettimeofday(&start_time,NULL)) {
		fprintf(stderr,"%s: gettimeofday failed!?!?\n", getprogname());
		exit(errno);
	}
	memset(&progressInfo, 0, sizeof(RF_ProgressInfo_t));
	pInfoPtr=&progressInfo;

	percent_done = 0;
	do_ioctl(fd, option, &pInfoPtr, "");
	start_value = progressInfo.completed;
	current_time = start_time;
	simple_eta = 0;
	last_eta = 0;
	
	tbit_value = 0;
	while(progressInfo.completed < progressInfo.total) {

		percent_done = (progressInfo.completed * 100) / 
			progressInfo.total;

		get_bar(bar_buffer, percent_done, 40);
		
		elapsed_sec = current_time.tv_sec - start_time.tv_sec;
		elapsed_usec = current_time.tv_usec - start_time.tv_usec;
		if (elapsed_usec < 0) {
			elapsed_usec-=1000000;
			elapsed_sec++;
		}

		elapsed = (double) elapsed_sec + 
			(double) elapsed_usec / 1000000.0;

		amount = progressInfo.completed - start_value;

		if (amount <= 0) { /* we don't do negatives (yet?) */
			amount = 0;
		}

		if (elapsed == 0)
			rate = 0.0;
		else
			rate = amount / elapsed;

		if (rate > 0.0) {
			simple_eta = (int) (((double)progressInfo.total - 
					     (double) progressInfo.completed) 
					    / rate);
		} else {
			simple_eta = -1;
		}

		if (simple_eta <=0) { 
			simple_eta = last_eta;
		} else {
			last_eta = simple_eta;
		}

		get_time_string(eta_buffer, simple_eta);

		snprintf(buffer,1024,"\r%3d%% |%s| ETA: %s %c",
			 percent_done,bar_buffer,eta_buffer,tbits[tbit_value]);

		write(fileno(stdout),buffer,strlen(buffer));
		fflush(stdout);

		if (++tbit_value>3) 
			tbit_value = 0;

		sleep(2);

		if (gettimeofday(&current_time,NULL)) {
			fprintf(stderr,"%s: gettimeofday failed!?!?\n",
				getprogname());
			exit(errno);
		}

		do_ioctl( fd, option, &pInfoPtr, "");
		

	}
	printf("\n");
}
예제 #8
0
파일: pci.c 프로젝트: wayling/Jiny-Kernel
static int read_dev_conf(uint8_t bus , uint8_t dev,uint8_t func)
{
	pci_dev_header_t header;
	pci_addr_t addr;
	int ret;
	int i,count_start;
	int msi_vector =0;

	addr.bus=bus;
	addr.device=dev;
	addr.function=func;
	header.vendor_id=0;
	header.device_id=0;
	pci_bars[bar_count].addr=0;
	count_start=bar_count;
	ret = pci_generic_read(&addr, 0, sizeof(header), &header);
	//BRK;
	if(ret != 0) {
		return -1;
	}

	if (header.vendor_id != 0xffff)
	{
		DEBUG(" PCI bus:%d devic:%d func:%d  vendor:%x devices:%x int:%x:%x baser:%i \n",bus,dev,func,header.vendor_id,header.device_id,header.interrupt_line,header.interrupt_pin,header.base_address_registers[0]);
		DEBUG("   base addr :%i :%i :%i :%i \n",header.base_address_registers[0],header.base_address_registers[1],header.base_address_registers[2],header.base_address_registers[3]);
		for(i=0; i<5;i++)
		{
			get_bar(&addr,i,&pci_bars[bar_count].addr,&pci_bars[bar_count].len);
			if (pci_bars[bar_count].addr != 0)
			{
				pci_bars[bar_count].len= (~pci_bars[bar_count].len)+1;
				pci_bars[bar_count].name="";
				bar_count++;
			}else
			{
				//break;
			}
		}

#ifdef MSI
		if (header.capabilities_pointer != 0 && header.device_id != 0x1009  ) { // do not msix for p9
			msi_vector=read_msi(&addr, header.capabilities_pointer, &pci_bars[count_start],i);
		}
#endif

		if (header.vendor_id == 0x1af4 && header.device_id==0x1110){
			init_host_shm(&header,&pci_bars[count_start],i,&msi_vector);
		}
#ifdef XEN
		else if (header.vendor_id == XEN_PLATFORM_VENDOR_ID  && header.device_id == XEN_PLATFORM_DEVICE_ID){
			init_xen_pci(&header,&pci_bars[count_start],i);
		}
#endif
#ifdef VIRTIO
#define VIRTIO_PCI_VENDOR_ID 0x1af4
		else if (header.vendor_id == VIRTIO_PCI_VENDOR_ID  && (header.device_id >= 0x1000 && header.device_id <= 0x103f) ){
			int msi_enabled = msi_vector;

			init_virtio_pci(&header,&pci_bars[count_start],i,&msi_vector);
			if (msi_enabled && msi_vector == 0) {
				//disable_msix(&addr,i); NOT working
			}
		}
#endif
	}
	return 1;
}