当前位置: 首页>>代码示例>>C++>>正文


C++ PCM类代码示例

本文整理汇总了C++中PCM的典型用法代码示例。如果您正苦于以下问题:C++ PCM类的具体用法?C++ PCM怎么用?C++ PCM使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PCM类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getCompressorShortedFault

    bool getCompressorShortedFault(void *pcm_pointer, int32_t *status) {
        PCM *module = (PCM *)pcm_pointer;
        bool value;

        *status = module->GetCompressorShortedFault(value);

        return value;
    }
开发者ID:FRC3238,项目名称:allwpilib,代码行数:8,代码来源:Compressor.cpp

示例2: getCompressorCurrent

    float getCompressorCurrent(void *pcm_pointer, int32_t *status) {
        PCM *module = (PCM *)pcm_pointer;
        float value;

        *status = module->GetCompressorCurrent(value);

        return value;
    }
开发者ID:FRC3238,项目名称:allwpilib,代码行数:8,代码来源:Compressor.cpp

示例3: getCompressorCurrentTooHighStickyFault

    bool getCompressorCurrentTooHighStickyFault(void *pcm_pointer, int32_t *status) {
        PCM *module = (PCM *)pcm_pointer;
        bool value;

        *status = module->GetCompressorCurrentTooHighStickyFault(value);

        return value;
    }
开发者ID:FRC3238,项目名称:allwpilib,代码行数:8,代码来源:Compressor.cpp

示例4: getClosedLoopControl

    bool getClosedLoopControl(void *pcm_pointer, int32_t *status) {
        PCM *module = (PCM *)pcm_pointer;
        bool value;

        *status = module->GetClosedLoopControl(value);

        return value;
    }
开发者ID:FRC3238,项目名称:allwpilib,代码行数:8,代码来源:Compressor.cpp

示例5: getPressureSwitch

    bool getPressureSwitch(void *pcm_pointer, int32_t *status) {
        PCM *module = (PCM *)pcm_pointer;
        bool value;

        *status = module->GetPressure(value);

        return value;
    }
开发者ID:FRC3238,项目名称:allwpilib,代码行数:8,代码来源:Compressor.cpp

示例6: getCompressorNotConnectedStickyFault

    bool getCompressorNotConnectedStickyFault(void *pcm_pointer, int32_t *status) {
        PCM *module = (PCM *)pcm_pointer;
        bool value;

        *status = module->GetCompressorNotConnectedStickyFault(value);

        return value;
    }
开发者ID:FRC3238,项目名称:allwpilib,代码行数:8,代码来源:Compressor.cpp

示例7: main

int main(int argc, char** argv)
{
    // Args
    var arg(argc, argv);

    // Read the waveform from file
    PCM pcm;
    ind fi = arg.index("-f");
    var wav = fi ? arg[fi+1] : "arctic_a0001.wav";
    var a = pcm.read(wav);

    // Frame it
    int frameSize = 256;
    int framePeriod = 128;
    var f = pcm.frame(a, frameSize, framePeriod);

    // Window the frames
    var w = nuttall(frameSize);
    f *= w;

    // Choose the output type
    ind ti = arg.index("-t");
    var t = ti ? arg[ti+1] : "spec";
    var p;
    if (t == "spec")
    {
        // Fourier transform
        lube::DFT dft(frameSize);
        var s = dft(f);

        // Periodogram
        p = lube::norm(s);
    }
    else if (t == "ar")
    {
        // LP spectrum
        int order = arorder(pcm.rate());
        Autocorrelation ac(frameSize);
        var af = ac(f);
        Levinson ar(order);
        var lf = ar(af);
        Gain gain(order);
        var g = gain(af, lf);
        Spectrum s(order, 129);
        p = s(lf, g);
    }

    // Plot
    var gnu;
    gnu.push("plot \"-\" matrix with image");
    gnu.push(lube::log(p+1e-8));
    file gnuf("gnuplot");
    gnuf.write(lube::nil, gnu);

    return 0;
}
开发者ID:liangnet,项目名称:libssp,代码行数:56,代码来源:specplot.cpp

示例8: sigSTOP_handler

/**
 * \brief handles signals that lead to update of configuration
 * such as SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU
 */
void sigSTOP_handler(int signum)
{
    PCM *m = PCM::getInstance();
    int runState = m->getRunState();
    std::string state = (runState==1 ? "suspend" : "continue");
    std::cerr << "DEBUG: caught signal to " << state << " execution." << std::endl; // debug of signals only
    if(runState==1) {
    // stop counters and sleep... almost forever;
        m->setRunState(0);
        sleep(INT_MAX);
    } else {
    // resume
        m->setRunState(1);
        alarm(1);
    }
    return;
}
开发者ID:SamDivine,项目名称:accirr,代码行数:21,代码来源:utils.cpp

示例9: pcmInit

void pcmInit() {
  std::cout << "Initializing PCM" << std::endl;
  PCM* m = PCM::getInstance();
  m->disableJKTWorkaround();
  
  switch( m->program() ) { 
    case PCM::Success:
      std::cout << "PCM Initialized" << std::endl;
			return;
  
    case PCM::PMUBusy:
      std::cout << "PCM::PMU Busy!" << std::endl;
      m->resetPMU();
			return;
  
    default:
      return;
	}
}
开发者ID:SemanticBeeng,项目名称:Delite,代码行数:19,代码来源:pcmHelper.cpp

示例10: initpcm

int32_t initpcm() {

	int ret = -1;
	PCM *m = PCM::getInstance();

	PCM::CustomCoreEventDescription para[4];

	if (m != NULL) {
		para[0].event_number = MEM_UOP_RETIRED;
		para[0].umask_value = LOADS;

		para[1].event_number = MEM_LOAD_UOPS_RETIRED_EVENT;
		para[1].umask_value = L1_HIT;

		para[2].event_number = MEM_LOAD_UOPS_RETIRED_EVENT;
		para[2].umask_value = L2_HIT;

		para[3].event_number = MEM_LOAD_UOPS_RETIRED_EVENT;
		para[3].umask_value = LLC_HIT;

		ret = m->program(PCM::CUSTOM_CORE_EVENTS, para);
	}
	return ret;
}
开发者ID:theta1990,项目名称:CommunicationSpeed,代码行数:24,代码来源:mypcm.cpp

示例11: main

int main(int argc, char * argv[])
{
    std::cout << "\n Intel(r) Performance Counter Monitor " << INTEL_PCM_VERSION << std::endl;
    std::cout << "\n Power Monitoring Utility\n Copyright (c) 2011-2012 Intel Corporation\n";
    
    int imc_profile = 0;
    int pcu_profile = 0;
    int delay = -1;
	char * ext_program = NULL;

	freq_band[0] = default_freq_band[0];
	freq_band[1] = default_freq_band[1];
	freq_band[2] = default_freq_band[2];


	int my_opt = -1;
	while ((my_opt = getopt(argc, argv, "m:p:a:b:c:")) != -1)
	{
		switch(my_opt)
		{
			case 'm':
				imc_profile = atoi(optarg);
				break;
			case 'p':
				pcu_profile = atoi(optarg);
				break;
			case 'a':
				freq_band[0] = atoi(optarg);
				break;
			case 'b':
				freq_band[1] = atoi(optarg);
				break;
			case 'c':
				freq_band[2] = atoi(optarg);
				break;
			default:
				print_usage(argv[0]);
				return -1;
		}
	}

	 if (optind >= argc)
	 {
		 print_usage(argv[0]);
		 return -1;
	 }

    delay = atoi(argv[optind]);
	if(delay == 0) 
		ext_program = argv[optind];
	else
		delay = (delay<0)?1:delay;

	#ifdef _MSC_VER
    // Increase the priority a bit to improve context switching delays on Windows
    SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);

    TCHAR driverPath[1024];
    GetCurrentDirectory(1024, driverPath);
    wcscat(driverPath, L"\\msr.sys");

    // WARNING: This driver code (msr.sys) is only for testing purposes, not for production use
    Driver drv;
    // drv.stop();     // restart driver (usually not needed)
    if (!drv.start(driverPath))
    {
		std::cout << "Can not access CPU performance counters" << std::endl;
		std::cout << "You must have signed msr.sys driver in your current directory and have administrator rights to run this program" << std::endl;
        return -1;
    }
    #endif

    PCM * m = PCM::getInstance();
    m->disableJKTWorkaround();

    if(!(m->hasPCICFGUncore()))
    {
       std::cout <<"Unsupported processor model ("<<m->getCPUModel()<<"). Only models "<<PCM::JAKETOWN<<" (JAKETOWN), " << PCM::IVYTOWN<< " (IVYTOWN)  are supported."<< std::endl;
       return -1;
    }

    if(PCM::Success != m->programServerUncorePowerMetrics(imc_profile,pcu_profile,freq_band))
    {
	  #ifdef _MSC_VER
		std::cout << "You must have signed msr.sys driver in your current directory and have administrator rights to run this program" << std::endl;
      #elif defined(__linux__)
      std::cout << "You need to be root and loaded 'msr' Linux kernel module to execute the program. You may load the 'msr' module with 'modprobe msr'. \n";
      #endif
      return -1;
    }
    ServerUncorePowerState * BeforeState = new ServerUncorePowerState[m->getNumSockets()];
	ServerUncorePowerState * AfterState = new ServerUncorePowerState[m->getNumSockets()];
	uint64 BeforeTime = 0, AfterTime = 0;
    
    std::cout << std::dec << std::endl;
    std::cout.precision(2);
    std::cout << std::fixed;
    std::cout << "\nMC counter group: "<<imc_profile << std::endl;
    std::cout << "PCU counter group: "<<pcu_profile << std::endl; 
	if(pcu_profile == 0)
//.........这里部分代码省略.........
开发者ID:PennPanda,项目名称:linux-repo,代码行数:101,代码来源:pcm-power.cpp

示例12: _this

PCM::PCM(const PCM& pcm)
  : functional::DirectAudio<PCM, sound::Sound>(pcm.a(), pcm.b(), pcm.settings()), _this(pcm._this) {}
开发者ID:codealphago,项目名称:vireo,代码行数:2,代码来源:pcm.cpp

示例13: setClosedLoopControl

    void setClosedLoopControl(void *pcm_pointer, bool value, int32_t *status) {
        PCM *module = (PCM *)pcm_pointer;

        *status = module->SetClosedLoopControl(value);
    }
开发者ID:FRC3238,项目名称:allwpilib,代码行数:5,代码来源:Compressor.cpp

示例14: clearAllPCMStickyFaults

    void clearAllPCMStickyFaults(void *pcm_pointer, int32_t *status) {
        PCM *module = (PCM *)pcm_pointer;

        *status = module->ClearStickyFaults();
    }
开发者ID:FRC3238,项目名称:allwpilib,代码行数:5,代码来源:Compressor.cpp

示例15: getCoreCounterState

CoreCounterState getCoreCounterState(int32_t tid) {                                       
  PCM * inst = PCM::getInstance();
  CoreCounterState result;
  if (inst) result = inst->getCoreCounterState(tid);
  return result;
}
开发者ID:SemanticBeeng,项目名称:Delite,代码行数:6,代码来源:pcmHelper.cpp


注:本文中的PCM类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。