• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ QUERY函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: uid

void MethodGetRecentContacts::onCall(const sg::rpc::Uri& target)
{
	common::UserID uid(common::UserPointID(this->getFrom()));

	mongo::BSONObj returnfield = BSON(COLL_RECENTCONTACTS_CONTACT << 1);

	mongo::ScopedDbConnection conn(
			MongoDBManagerSingleton::instance().host());

	auto_ptr<mongo::DBClientCursor> cursor = conn->query(
			COLL_RECENTCONTACTS,
			QUERY(COLL_RECENTCONTACTS_UID << uid.toString()).sort(COLL_RECENTCONTACTS_CONTACT"."COLL_RECENTCONTACTS_CONTACT_TIME, -1),
			getRequestData().max_count(),
			0,
			&returnfield);

	methods::rpc::GetRecentContactsResponse resp;
	while (cursor->more())
	{
		mongo::BSONObj p = cursor->nextSafe();

		methods::rpc::GetRecentContactsResponse_Contact* contact = resp.add_contacts();

		common::UserID contact_uid;
		contact_uid.parseFromString(p[COLL_RECENTCONTACTS_CONTACT_UID].String());
		contact_uid.get(contact->mutable_user_id());

		bool flag = p[COLL_CHATMSGS_DATA_FLAG].Int();
		if (contact_uid.uid < uid.uid)
			flag = !flag;

		methods::rpc::ChatMsgData* pdata = contact->mutable_last_msg();
		pdata->set_flag(flag ? methods::rpc::ChatMsgData_Flag_FLAG_RECV : methods::rpc::ChatMsgData_Flag_FLAG_SEND);
		pdata->set_msg_id(p[COLL_CHATMSGS_DATA_MSGID].Long());
		pdata->set_msg_time(p[COLL_CHATMSGS_DATA_TIME].Date().toTimeT());
		p[COLL_CHATMSGS_DATA_CONTENT_TYPE].Val(*pdata->mutable_content_type());
		p[COLL_CHATMSGS_DATA_CONTENT].Val(*pdata->mutable_content());
	}

	conn.done();

	reply(target, resp);
}
开发者ID:haoustc,项目名称:server1,代码行数:43,代码来源:method_get_recent_contacts.cpp


示例2: cmd_window_server

static void cmd_window_server(const char *data)
{
	SERVER_REC *server;
        QUERY_REC *query;

	g_return_if_fail(data != NULL);

	server = server_find_tag(data);
        query = QUERY(active_win->active);
	if (server == NULL || query == NULL)
		return;

	/* /WINDOW SERVER used in a query window */
	query_change_server(query, server);
	printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
		    TXT_QUERY_SERVER_CHANGED,
		    query->name, server->tag);
	signal_stop();
}
开发者ID:svn2github,项目名称:irssi,代码行数:19,代码来源:fe-queries.c


示例3: QUERY

    Status AuthzManagerExternalStateMongod::updatePrivilegeDocument(
            const UserName& user, const BSONObj& updateObj, const BSONObj& writeConcern) {
        try {
            const std::string userNS = "admin.system.users";
            DBDirectClient client;
            {
                Client::GodScope gs;
                // TODO(spencer): Once we're no longer fully rebuilding the user cache on every
                // change to user data we should remove the global lock and uncomment the
                // WriteContext below
                Lock::GlobalWrite w;
                // Client::WriteContext ctx(userNS);
                client.update(userNS,
                              QUERY(AuthorizationManager::USER_NAME_FIELD_NAME << user.getUser() <<
                                    AuthorizationManager::USER_SOURCE_FIELD_NAME << user.getDB()),
                              updateObj);
            }

            // Handle write concern
            BSONObjBuilder gleBuilder;
            gleBuilder.append("getLastError", 1);
            gleBuilder.appendElements(writeConcern);
            BSONObj res;
            client.runCommand("admin", gleBuilder.done(), res);
            string err = client.getLastErrorString(res);
            if (!err.empty()) {
                return Status(ErrorCodes::UserModificationFailed, err);
            }

            int numUpdated = res["n"].numberInt();
            dassert(numUpdated <= 1 && numUpdated >= 0);
            if (numUpdated == 0) {
                return Status(ErrorCodes::UserNotFound,
                              mongoutils::str::stream() << "User " << user.getFullName() <<
                                      " not found");
            }

            return Status::OK();
        } catch (const DBException& e) {
            return e.toStatus();
        }
    }
开发者ID:barayuda,项目名称:mongo,代码行数:42,代码来源:authz_manager_external_state_d.cpp


示例4: process_cmd

static int process_cmd (const char *line)
{
    RESULT[0] = '\0';
    if      (matchstr (&line, "EJECT"))        return EJECT (line);
    else if (matchstr (&line, "INSERT"))       return INSERT (line);
    else if (matchstr (&line, "QUERY"))        return QUERY (line);
    else if (matchstr (&line, "FEEDBACK"))     return FEEDBACK (line);
    else if (matchstr (&line, "VERSION"))      return GET_VERSION (line);
    else if (matchstr (&line, "BYE"))          QUIT ();
    else if (matchstr (&line, "QUIT"))         QUIT ();
    else if (matchstr (&line, "DEBUG"))        return DEBUG ();
    else if (matchstr (&line, "RESET"))        m68k_reset (0);
    else if (matchstr (&line, "DISPLAY"))      return DISPLAY (line);
    else if (matchstr (&line, "FRAMERATE"))    return FRAMERATE( line);
    else if (matchstr (&line, "FAKEJOYSTICK")) return FAKEJOYSTICK (line);
    else if (matchstr (&line, "SOUND"))        return SOUND (line);
    else if (matchstr (&line, "UAEEXE"))       return UAEEXE (line);
    else return RC_ERROR;
    return RC_OK;
}
开发者ID:diablodiab,项目名称:libretro-uae,代码行数:20,代码来源:ami-rexx.c


示例5: QUERY

void UpdateGoogleData::doInBackground(const mongo::OID & user_id,CompletionHandler handler){
	std::cout << "do" << boost::this_thread::get_id() << std::endl;

	Log * log = Log::Instance();
	Config * config = Config::Instance();

	log->write("Update user google info: " + user_id.toString());

	bool ok = false;
	char *req_url = NULL;
	char *reply   = NULL;
	DB * db = DB::Instance();
	std::string mail,
		name,
		profile,
		thumbnail;

	if(db){
		mongo::BSONObj user = db->findOne("yquest.users", QUERY("_id" << user_id));
		if(user.valid()){
		req_url = oauth_sign_url2(config->OAUTH_PROFILE_REQUEST_URL.c_str(),
	    		NULL,
	    		OA_HMAC,
	    		NULL,
	    		config->OAUTH_KEY.c_str(),
	    		config->OAUTH_SECRET.c_str(),
	    		user["oauth_token"].String().c_str(),
	    		user["oauth_token_secret"].String().c_str());
	    reply = oauth_http_get(req_url,NULL);
	    log->write(reply);

	     std::stringstream stream(reply);
	     boost::property_tree::ptree ptree;
	      boost::property_tree::json_parser::read_json(stream, ptree);
	      std::cout << ptree.get<std::string>("entry.displayName")<< std::endl;
		}
	}
	io_service.post(boost::bind(handler,ok));

	delete this;
}
开发者ID:Chudovishee,项目名称:yquest,代码行数:41,代码来源:UpdateGoogleData.cpp


示例6: msg

/**
 * (re)connect to database
 */
int IpfixDbWriterMongo::connectToDB()
{
	dbError = true;
	
	// If a connection exists don't reconnect
	if (con.isFailed()) return 0;
  
  // Connect
  string err;
  mongo::HostAndPort dbLogon;
  dbLogon = mongo::HostAndPort(dbHost, dbPort);
  msg(MSG_INFO,"IpfixDbWriterMongo: Connection details: %s", dbLogon.toString().c_str());
  if(!con.connect(dbLogon, err))
	{
		msg(MSG_FATAL,"IpfixDbWriterMongo: Mongo connect failed. Error: %s", err.c_str());
		return 1;
	}
    
  if(!dbUser.empty() && !dbPassword.empty()) 
  {
    // we need to authenticate
    if(!con.auth(dbName, dbUser, dbPassword, err))
	  {
		  msg(MSG_FATAL,"IpfixDbWriterMongo: Mongo authentication failed. Error: %s", err.c_str());
		  return 1;
	  }
  }

  // create couter to support incrementing Exporter IDs
  if(con.findOne(dbCollectionCounters, QUERY("_id" << "exporterCounter")).isEmpty())
  {
    mongo::BSONObjBuilder b;
    b << "_id" << "exporterCounter" << "c" << 0;
    mongo::BSONObj obj = b.obj();
    con.insert(dbCollectionCounters, obj);
  }

	msg(MSG_DEBUG,"IpfixDbWriterMongo: Mongo connection successful");
	dbError = false;
	return 0;
}
开发者ID:JammyStuff,项目名称:vermont,代码行数:44,代码来源:IpfixDbWriterMongo.cpp


示例7: getConfig

Eina_Bool getConfig(DB *db, Zentific_Ctx *ctx, const char *key, const char *subsystem,
	int mid, int uid, int gid, int vgid, int ngid, int vm,
	int node, int platform, int role){

	if (!key || !subsystem || !key[0] || !subsystem[0]){
		ctx->error = AZY_ERR(INVALID_PARAMETER);
		return EINA_FALSE;
	}

	DB_VARS;
	QUERY(KEYVALUE_esql,
		"SELECT * FROM `config` WHERE `key`='%s'"
		" AND `subsystem`='%s' AND `mid`='%d'"
		" AND `uid`='%d' AND `gid`='%d' AND `vgid`='%d'"
		" AND `ngid`='%d' AND `vm`='%d' AND `node`='%d'"
		" AND `platform`='%d' AND `role`='%d'",
		key, subsystem, mid, uid, gid,
		vgid, ngid, vm, node, platform, role);
	ctx->free_func = (Ecore_Cb)KEYVALUE_free;
	QID_RETURN;
}
开发者ID:zmike,项目名称:ezrpc,代码行数:21,代码来源:zrpcdb_zentific.c


示例8: e_data_cal_view_get_property

static void
e_data_cal_view_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
{
	EDataCalView *query;
	EDataCalViewPrivate *priv;

	query = QUERY (object);
	priv = query->priv;

	switch (property_id) {
	case PROP_BACKEND:
		g_value_set_object (value, priv->backend);
		break;
	case PROP_SEXP:
		g_value_set_object (value, priv->sexp);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}
开发者ID:nobled,项目名称:evolution-data-server,代码行数:21,代码来源:e-data-cal-view.c


示例9: cmd_unquery

/* SYNTAX: UNQUERY [<nick>] */
static void cmd_unquery(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
{
	QUERY_REC *query;

	g_return_if_fail(data != NULL);

	if (*data == '\0') {
		/* remove current query */
		query = QUERY(item);
		if (query == NULL) return;
	} else {
		query = query_find(server, data);
		if (query == NULL) {
			printformat(server, NULL, MSGLEVEL_CLIENTERROR,
				    TXT_NO_QUERY, data);
			return;
		}
	}

	query_destroy(query);
}
开发者ID:svn2github,项目名称:irssi,代码行数:22,代码来源:fe-queries.c


示例10: BSON

void User::IncrCredits(const std::string& section, long long kBytes)
{
  auto doIncrement = [section, kBytes](acl::UserID uid)
    {
      NoErrorConnection conn;
      auto updateExisting = [&]() -> bool
        {
          auto query = BSON("uid" << uid << 
                            "credits" << BSON("$elemMatch" << BSON("section" << section)));
                            
          auto update = BSON("$inc" << BSON("credits.$.value" << kBytes));
                            
          auto cmd = BSON("findandmodify" << "users" <<
                          "query" << query <<
                          "update" << update);
                          
          mongo::BSONObj result;
          return conn.RunCommand(cmd, result) && 
                 result["value"].type() != mongo::jstNULL;
        };

      auto doInsert = [&]() -> bool
      {
        auto query = QUERY("uid" << uid << "credits" << BSON("$not" << 
                           BSON("$elemMatch" << BSON("section" << section))));
        auto update = BSON("$push" << BSON("credits" << BSON("section" << section << "value" << kBytes)));
        return conn.Update("users", query, update, false) > 0;
      };
      
      if (updateExisting()) return;
      if (doInsert()) return;
      if (updateExisting()) return;

      logs::Database("Unable to increment credits for UID %1%%2%", uid,
                     !section.empty() ? " in section " + section : 
                     std::string(""));
    };
  
  asyncTasks.Assign(std::async(std::launch::async, doIncrement, user.id));
}
开发者ID:arrrrrrr,项目名称:ebftpd,代码行数:40,代码来源:user.cpp


示例11: while

void CComputeRowDataProcessor::ComputeData()
{
	bool bResult = false;
	BSONObj boRowRecord, boVLanInfo;
	Query queryRackInRow;
	CRackModel *pRackModel;
	CRowModel *pRowModel;
	auto_ptr<DBClientCursor> ptrRackCursor = auto_ptr<DBClientCursor>();
	while (m_ptrCursor->more())
	{
		boRowRecord = m_ptrCursor->nextSafe();
		if (pRowModel->GetRackQuery(queryRackInRow, boRowRecord))
		{
			if (m_pRackController->Find(ptrRackCursor, queryRackInRow))
			{
				boVLanInfo = pRackModel->GetVLanInfo(ptrRackCursor);
				m_pCIController->Update(boVLanInfo, QUERY("_id" << boRowRecord["_id"]));
			}
		}
		ptrRackCursor.reset();
	}
}
开发者ID:fr34k8,项目名称:CMDBv2,代码行数:22,代码来源:ComputeRowDataProcessor.cpp


示例12: QUERY

//-----------------------------------------------------------------------------
bool solution_c::fetch( Reveal::Core::solution_ptr& solution, Reveal::DB::database_ptr db, std::string experiment_id, std::string scenario_id, double t, double epsilon ) {
  std::auto_ptr<mongo::DBClientCursor> cursor;
  Reveal::Core::scenario_ptr ptr;
  std::string table = "solution";

  mongo_ptr mongo = mongo_c::service( db );
  if( !mongo ) return false;

  double lbound = t - epsilon;
  double ubound = t + epsilon;

  mongo->fetch( cursor, table, QUERY( "experiment_id" << experiment_id << "scenario_id" << scenario_id << "t" << mongo::GTE << lbound << mongo::LTE << ubound ) );

  if( !cursor->more() ) return false;

  // TODO: add error handling
  mongo::BSONObj record = cursor->next();

  map( solution, record, Reveal::Core::solution_c::CLIENT );

  return true;
}
开发者ID:jacquelinekay,项目名称:reveal,代码行数:23,代码来源:solution.cpp


示例13: uid

void MethodRemoveRecentContacts::onCall(const sg::rpc::Uri& target)
{
	if (getRequestData().user_ids_size())
	{
		common::UserID uid(common::UserPointID(this->getFrom()));

		mongo::ScopedDbConnection conn(
				MongoDBManagerSingleton::instance().host());

		mongo::BSONArrayBuilder contactsBuilder;
		for (int i=0; i<getRequestData().user_ids_size(); ++i)
		{
			contactsBuilder << common::UserID(getRequestData().user_ids(i)).toString();
		}

		conn->remove(COLL_RECENTCONTACTS,
				QUERY(COLL_RECENTCONTACTS_UID << uid.toString() << "$or" << BSON(COLL_RECENTCONTACTS_CONTACT << contactsBuilder.arr())));

		conn.done();
	}
	reply(target);
}
开发者ID:haoustc,项目名称:server1,代码行数:22,代码来源:method_remove_recent_contacts.cpp


示例14: conn

    Status AuthzManagerExternalStateMongos::updatePrivilegeDocument(
            const UserName& user, const BSONObj& updateObj, const BSONObj& writeConcern) {
        try {
            const std::string userNS = "admin.system.users";
            scoped_ptr<ScopedDbConnection> conn(getConnectionForAuthzCollection(userNS));

            conn->get()->update(
                    userNS,
                    QUERY(AuthorizationManager::USER_NAME_FIELD_NAME << user.getUser() <<
                          AuthorizationManager::USER_SOURCE_FIELD_NAME << user.getDB()),
                    updateObj);

            // Handle write concern
            BSONObjBuilder gleBuilder;
            gleBuilder.append("getLastError", 1);
            gleBuilder.appendElements(writeConcern);
            BSONObj res;
            conn->get()->runCommand("admin", gleBuilder.done(), res);
            string err = conn->get()->getLastErrorString(res);
            conn->done();

            if (!err.empty()) {
                return Status(ErrorCodes::UserModificationFailed, err);
            }

            int numUpdated = res["n"].numberInt();
            dassert(numUpdated <= 1 && numUpdated >= 0);
            if (numUpdated == 0) {
                return Status(ErrorCodes::UserNotFound,
                              mongoutils::str::stream() << "User " << user.getFullName() <<
                                      " not found");
            }

            return Status::OK();
        } catch (const DBException& e) {
            return e.toStatus();
        }
    }
开发者ID:barayuda,项目名称:mongo,代码行数:38,代码来源:authz_manager_external_state_s.cpp


示例15: id

  void
  FilesystemEntry::updateContentType(mongo::GridFile& gridfile, 
                                     mode_t mode, 
                                     uid_t uid, 
                                     gid_t gid,
                                     time_t time)
  {
    std::stringstream lContentType;    
    lContentType << "m:" << mode << "|u:" << uid << "|g:" << gid << "|t:" << time;

    // create update filter and query
    mongo::OID id(gridfile.getFileField("_id").OID().str());
    mongo::Query filter = QUERY("_id" << id);
    mongo::BSONObj update = BSON( "$set" 
                               << BSON ( "contentType" << lContentType.str() ));

    // update it
    // TODO DK this is not multi process safe because it doesn't store a new file 
    //         entry, but don't see a better solution yet.
    theConnection->update(filesCollection(), filter, update);

    synchonizeUpdate();
  }
开发者ID:28msec,项目名称:gridfs-fuse,代码行数:23,代码来源:filesystem_entry.cpp


示例16: QUERY

    Status AuthzManagerExternalStateMongod::updatePrivilegeDocument(
            const UserName& user, const BSONObj& updateObj) {
        try {
            string userNS = mongoutils::str::stream() << user.getDB() << ".system.users";
            DBDirectClient client;
            {
                Client::GodScope gs;
                // TODO(spencer): Once we're no longer fully rebuilding the user cache on every
                // change to user data we should remove the global lock and uncomment the
                // WriteContext below
                Lock::GlobalWrite w;
                // Client::WriteContext ctx(userNS);
                client.update(userNS,
                              QUERY("user" << user.getUser() << "userSource" << BSONNULL),
                              updateObj);
            }

            // 30 second timeout for w:majority
            BSONObj res = client.getLastErrorDetailed(false, false, -1, 30*1000);
            string err = client.getLastErrorString(res);
            if (!err.empty()) {
                return Status(ErrorCodes::UserModificationFailed, err);
            }

            int numUpdated = res["n"].numberInt();
            dassert(numUpdated <= 1 && numUpdated >= 0);
            if (numUpdated == 0) {
                return Status(ErrorCodes::UserNotFound,
                              mongoutils::str::stream() << "User " << user.getFullName() <<
                                      " not found");
            }

            return Status::OK();
        } catch (const DBException& e) {
            return e.toStatus();
        }
    }
开发者ID:man27382210,项目名称:mongo,代码行数:37,代码来源:authz_manager_external_state_d.cpp


示例17: QUERY

//-----------------------------------------------------------------------------
bool trial_c::fetch( Reveal::Core::trial_ptr& trial, Reveal::DB::database_ptr db, std::string scenario_id, double t, double epsilon ) {
  std::auto_ptr<mongo::DBClientCursor> cursor;
//  Reveal::DB::query_c query;
  Reveal::Core::scenario_ptr ptr;

  // get mongo service and verify
  mongo_ptr mongo = mongo_c::service( db );
  if( !mongo ) return false;

  double lbound = t - epsilon;
  double ubound = t + epsilon;

  //mongo->fetch( cursor, "trial", QUERY( "scenario_id" << scenario_id << "t" << t ) );
  mongo->fetch( cursor, "trial", QUERY( "scenario_id" << scenario_id << "t" << mongo::GTE << lbound << mongo::LTE << ubound) );

  if( !cursor->more() ) return false;

  // add error handling
  mongo::BSONObj record = cursor->next();

  map( trial, record );

  return true;
}
开发者ID:jacquelinekay,项目名称:reveal,代码行数:25,代码来源:trial.cpp


示例18: getInstance

void DB::loadOrders() {
	mongo::BSONObj o_max = getInstance().findOne("btct.orders", mongo::Query().sort("_id", -1));
	mongo::BSONObj t_max = getInstance().findOne("btct.transactions", mongo::Query().sort("_id", -1));
	uint64_t o_next_id = o_max.getField("_id").ok()?o_max.getField("_id").Long():10000;
	if(o_next_id < 10000) {
		o_next_id = 10000;
	}
	uint64_t t_next_id = t_max.getField("_id").ok()?t_max.getField("_id").Long():1;
	if(t_next_id <= 1){
		t_next_id = 1;
	}
	Order::next_id = o_next_id + 1;
	Transaction::next_id = t_next_id + 1;

	std::auto_ptr<mongo::DBClientCursor> cursor = getInstance().query("btct.orders", QUERY("qty" << mongo::GT << 0));
	int order_count = 0;
	printf("Loading orders...\n");
	while (cursor->more()) {
		mongo::BSONObj p = cursor->next();
		Market *market = Market::markets[p.getIntField("market_id")];
		Order *o = new Order(
				market,
				(const uint32_t) p.getIntField("account_id"),
				(const order_type_t) p.getBoolField("direction"),
				(const uint64_t) p.getField("qty").Long(),
				(const uint64_t) p.getField("orig_qty").Long(),
				(const uint64_t) p.getField("price").Long(),
				(const uint64_t) p.getField("_id").Long(),
				(const uint32_t) p.getIntField("timestamp"),
				(const order_status_t) p.getIntField("status"));
		market->addOrder(o);
		order_count++;
	}
	printf("Loaded %u orders\n", order_count);
	printf("Biggest order number: %llu\n", o_next_id);
}
开发者ID:allada,项目名称:BitcoinTradeEngine,代码行数:36,代码来源:DB.cpp


示例19: rlib_free_results_and_queries

/*
 * Free all the data allocated for queries and results.
 * This is called by rlib_free() when destroying everything.
 */
static void rlib_free_results_and_queries(rlib *r) {
	int i;

	for (i = 0; i < r->queries_count; i++) {
		if (r->results[i]->result && INPUT(r, i)->free_result) {
			INPUT(r, i)->free_result(INPUT(r, i), r->results[i]->result);
			r->results[i]->result = NULL;
		}
		g_free(r->results[i]);
		r->results[i] = NULL;
		if (QUERY(r, i) && QUERY(r, i)->input && QUERY(r, i)->input->free_query)
			QUERY(r, i)->input->free_query(QUERY(r, i)->input, QUERY(r, i));
		if (r->queries[i]->sql_allocated)
			g_free(r->queries[i]->sql);
		g_free(r->queries[i]->name);
		g_free(r->queries[i]);
		r->queries[i] = NULL;
	}
	g_free(r->results);
	r->results = NULL;
	g_free(r->queries);
	r->queries = NULL;
	r->queries_count = 0;
}
开发者ID:SICOM,项目名称:rlib,代码行数:28,代码来源:free.c


示例20: svga_get_driver_query_info

static int
svga_get_driver_query_info(struct pipe_screen *screen,
                           unsigned index,
                           struct pipe_driver_query_info *info)
{
#define QUERY(NAME, ENUM, UNITS) \
   {NAME, ENUM, {0}, UNITS, PIPE_DRIVER_QUERY_RESULT_TYPE_AVERAGE, 0, 0x0}

   static const struct pipe_driver_query_info queries[] = {
      /* per-frame counters */
      QUERY("num-draw-calls", SVGA_QUERY_NUM_DRAW_CALLS,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("num-fallbacks", SVGA_QUERY_NUM_FALLBACKS,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("num-flushes", SVGA_QUERY_NUM_FLUSHES,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("num-validations", SVGA_QUERY_NUM_VALIDATIONS,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("map-buffer-time", SVGA_QUERY_MAP_BUFFER_TIME,
            PIPE_DRIVER_QUERY_TYPE_MICROSECONDS),
      QUERY("num-resources-mapped", SVGA_QUERY_NUM_RESOURCES_MAPPED,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("num-bytes-uploaded", SVGA_QUERY_NUM_BYTES_UPLOADED,
            PIPE_DRIVER_QUERY_TYPE_BYTES),
      QUERY("command-buffer-size", SVGA_QUERY_COMMAND_BUFFER_SIZE,
            PIPE_DRIVER_QUERY_TYPE_BYTES),
      QUERY("flush-time", SVGA_QUERY_FLUSH_TIME,
            PIPE_DRIVER_QUERY_TYPE_MICROSECONDS),
      QUERY("surface-write-flushes", SVGA_QUERY_SURFACE_WRITE_FLUSHES,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("num-readbacks", SVGA_QUERY_NUM_READBACKS,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("num-resource-updates", SVGA_QUERY_NUM_RESOURCE_UPDATES,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("num-buffer-uploads", SVGA_QUERY_NUM_BUFFER_UPLOADS,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("num-const-buf-updates", SVGA_QUERY_NUM_CONST_BUF_UPDATES,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("num-const-updates", SVGA_QUERY_NUM_CONST_UPDATES,
            PIPE_DRIVER_QUERY_TYPE_UINT64),

      /* running total counters */
      QUERY("memory-used", SVGA_QUERY_MEMORY_USED,
            PIPE_DRIVER_QUERY_TYPE_BYTES),
      QUERY("num-shaders", SVGA_QUERY_NUM_SHADERS,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("num-resources", SVGA_QUERY_NUM_RESOURCES,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("num-state-objects", SVGA_QUERY_NUM_STATE_OBJECTS,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("num-surface-views", SVGA_QUERY_NUM_SURFACE_VIEWS,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
      QUERY("num-generate-mipmap", SVGA_QUERY_NUM_GENERATE_MIPMAP,
            PIPE_DRIVER_QUERY_TYPE_UINT64),
   };
#undef QUERY

   if (!info)
      return Elements(queries);

   if (index >= Elements(queries))
      return 0;

   *info = queries[index];
   return 1;
}
开发者ID:gqmelo,项目名称:mesa,代码行数:66,代码来源:svga_screen.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ QUERYINTERFACE函数代码示例发布时间:2022-05-30
下一篇:
C++ QTransform函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap