void UserBasicInfo::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (has_uid()) { if (uid_ != &::google::protobuf::internal::kEmptyString) { uid_->clear(); } } if (has_name()) { if (name_ != &::google::protobuf::internal::kEmptyString) { name_->clear(); } } level_ = 1u; style_ = 0u; wincount_ = 0u; losecount_ = 0u; winrate_ = 0; if (has_effect()) { if (effect_ != NULL) effect_->::message::UserBasicInfo_EffectData::Clear(); } } if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { iconid_ = 6000u; successionwincount_ = 0u; oncelong_ = 0u; maximum_ = GOOGLE_ULONGLONG(0); totaltime_ = GOOGLE_ULONGLONG(0); roundsplayed_ = 0u; throwstones_ = 0u; thrownstones_ = 0u; } if (_has_bits_[16 / 32] & (0xffu << (16 % 32))) { colorcats_ = 0u; consumegolds_ = 0u; consumeitems1_ = 0u; consumeitems2_ = 0u; consumeitems3_ = 0u; consumeitems4_ = 0u; golds_ = 0u; experience_ = 0u; } if (_has_bits_[24 / 32] & (0xffu << (24 % 32))) { maxexperience_ = 1u; } buyequipframe_.Clear(); ::memset(_has_bits_, 0, sizeof(_has_bits_)); }
static void prstat_scandir(DIR *procdir) { char *pidstr; pid_t pid; id_t lwpid; size_t entsz; long nlwps, nent, i; char *buf, *ptr; fds_t *fds; lwp_info_t *lwp; dirent_t *direntp; prheader_t header; psinfo_t psinfo; prusage_t usage; lwpsinfo_t *lwpsinfo; prusage_t *lwpusage; total_procs = 0; total_lwps = 0; total_cpu = 0; total_mem = 0; convert_zone(&zone_tbl); for (rewinddir(procdir); (direntp = readdir(procdir)); ) { pidstr = direntp->d_name; if (pidstr[0] == '.') /* skip "." and ".." */ continue; pid = atoi(pidstr); if (pid == 0 || pid == 2 || pid == 3) continue; /* skip sched, pageout and fsflush */ if (has_element(&pid_tbl, pid) == 0) continue; /* check if we really want this pid */ fds = fds_get(pid); /* get ptr to file descriptors */ if (read_procfile(&fds->fds_psinfo, pidstr, "psinfo", &psinfo, sizeof (psinfo_t)) != 0) continue; if (!has_uid(&ruid_tbl, psinfo.pr_uid) || !has_uid(&euid_tbl, psinfo.pr_euid) || !has_element(&prj_tbl, psinfo.pr_projid) || !has_element(&tsk_tbl, psinfo.pr_taskid) || !has_zone(&zone_tbl, psinfo.pr_zoneid)) { fd_close(fds->fds_psinfo); continue; } nlwps = psinfo.pr_nlwp + psinfo.pr_nzomb; if (nlwps > 1 && (opts.o_outpmode & (OPT_LWPS | OPT_PSETS))) { int rep_lwp = 0; if (read_procfile(&fds->fds_lpsinfo, pidstr, "lpsinfo", &header, sizeof (prheader_t)) != 0) { fd_close(fds->fds_psinfo); continue; } nent = header.pr_nent; entsz = header.pr_entsize * nent; ptr = buf = Malloc(entsz); if (pread(fd_getfd(fds->fds_lpsinfo), buf, entsz, sizeof (struct prheader)) != entsz) { fd_close(fds->fds_lpsinfo); fd_close(fds->fds_psinfo); free(buf); continue; } nlwps = 0; for (i = 0; i < nent; i++, ptr += header.pr_entsize) { /*LINTED ALIGNMENT*/ lwpsinfo = (lwpsinfo_t *)ptr; if (!has_element(&cpu_tbl, lwpsinfo->pr_onpro) || !has_element(&set_tbl, lwpsinfo->pr_bindpset)) continue; nlwps++; if ((opts.o_outpmode & (OPT_PSETS | OPT_LWPS)) == OPT_PSETS) { /* * If one of process's LWPs is bound * to a given processor set, report the * whole process. We may be doing this * a few times but we'll get an accurate * lwp count in return. */ add_proc(&psinfo); } else { if (rep_lwp == 0) { rep_lwp = 1; add_lwp(&psinfo, lwpsinfo, LWP_REPRESENT); } else { add_lwp(&psinfo, lwpsinfo, 0); } } } free(buf); if (nlwps == 0) { fd_close(fds->fds_lpsinfo); fd_close(fds->fds_psinfo); continue; } } else { if (!has_element(&cpu_tbl, psinfo.pr_lwp.pr_onpro) || !has_element(&set_tbl, psinfo.pr_lwp.pr_bindpset)) { fd_close(fds->fds_psinfo); continue; } add_proc(&psinfo); } if (!(opts.o_outpmode & OPT_MSACCT)) { total_procs++; total_lwps += nlwps; continue; } /* * Get more information about processes from /proc/pid/usage. * If process has more than one lwp, then we may have to * also look at the /proc/pid/lusage file. */ if ((opts.o_outpmode & OPT_LWPS) && (nlwps > 1)) { if (read_procfile(&fds->fds_lusage, pidstr, "lusage", &header, sizeof (prheader_t)) != 0) { fd_close(fds->fds_lpsinfo); fd_close(fds->fds_psinfo); continue; } nent = header.pr_nent; entsz = header.pr_entsize * nent; buf = Malloc(entsz); if (pread(fd_getfd(fds->fds_lusage), buf, entsz, sizeof (struct prheader)) != entsz) { fd_close(fds->fds_lusage); fd_close(fds->fds_lpsinfo); fd_close(fds->fds_psinfo); free(buf); continue; } for (i = 1, ptr = buf + header.pr_entsize; i < nent; i++, ptr += header.pr_entsize) { /*LINTED ALIGNMENT*/ lwpusage = (prusage_t *)ptr; lwpid = lwpusage->pr_lwpid; /* * New LWPs created after we read lpsinfo * will be ignored. Don't want to do * everything all over again. */ if ((lwp = lwpid_get(pid, lwpid)) == NULL) continue; lwp_update(lwp, pid, lwpid, lwpusage); } free(buf); } else { if (read_procfile(&fds->fds_usage, pidstr, "usage", &usage, sizeof (prusage_t)) != 0) { fd_close(fds->fds_lpsinfo); fd_close(fds->fds_psinfo); continue; } lwpid = psinfo.pr_lwp.pr_lwpid; if ((lwp = lwpid_get(pid, lwpid)) == NULL) continue; lwp_update(lwp, pid, lwpid, &usage); } total_procs++; total_lwps += nlwps; } fd_update(); }
void UserBasicInfo::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // optional string uid = 1; if (has_uid()) { ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->uid(), output); } // optional string name = 2; if (has_name()) { ::google::protobuf::internal::WireFormatLite::WriteString( 2, this->name(), output); } // optional uint32 level = 3 [default = 1]; if (has_level()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->level(), output); } // optional uint32 style = 4; if (has_style()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->style(), output); } // optional uint32 winCount = 5; if (has_wincount()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->wincount(), output); } // optional uint32 loseCount = 6; if (has_losecount()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->losecount(), output); } // optional float winRate = 7; if (has_winrate()) { ::google::protobuf::internal::WireFormatLite::WriteFloat(7, this->winrate(), output); } // optional .message.UserBasicInfo.EffectData effect = 8; if (has_effect()) { ::google::protobuf::internal::WireFormatLite::WriteMessage( 8, this->effect(), output); } // optional uint32 iconId = 9 [default = 6000]; if (has_iconid()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(9, this->iconid(), output); } // optional uint32 successionWinCount = 10; if (has_successionwincount()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(10, this->successionwincount(), output); } // optional uint32 onceLong = 11; if (has_oncelong()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(11, this->oncelong(), output); } // optional uint64 maximum = 12; if (has_maximum()) { ::google::protobuf::internal::WireFormatLite::WriteUInt64(12, this->maximum(), output); } // optional uint64 totalTime = 13; if (has_totaltime()) { ::google::protobuf::internal::WireFormatLite::WriteUInt64(13, this->totaltime(), output); } // optional uint32 roundsPlayed = 14; if (has_roundsplayed()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(14, this->roundsplayed(), output); } // optional uint32 throwStones = 15; if (has_throwstones()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(15, this->throwstones(), output); } // optional uint32 thrownStones = 16; if (has_thrownstones()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(16, this->thrownstones(), output); } // optional uint32 colorCats = 17; if (has_colorcats()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(17, this->colorcats(), output); } // optional uint32 consumeGolds = 18; if (has_consumegolds()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(18, this->consumegolds(), output); } // optional uint32 consumeItems1 = 19; if (has_consumeitems1()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(19, this->consumeitems1(), output); } // optional uint32 consumeItems2 = 20; if (has_consumeitems2()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(20, this->consumeitems2(), output); } // optional uint32 consumeItems3 = 21; if (has_consumeitems3()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(21, this->consumeitems3(), output); } // optional uint32 consumeItems4 = 22; if (has_consumeitems4()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(22, this->consumeitems4(), output); } // optional uint32 golds = 23; if (has_golds()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(23, this->golds(), output); } // optional uint32 experience = 24; if (has_experience()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(24, this->experience(), output); } // optional uint32 maxExperience = 25 [default = 1]; if (has_maxexperience()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(25, this->maxexperience(), output); } // repeated uint32 buyEquipFrame = 26; for (int i = 0; i < this->buyequipframe_size(); i++) { ::google::protobuf::internal::WireFormatLite::WriteUInt32( 26, this->buyequipframe(i), output); } }
int UserBasicInfo::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional string uid = 1; if (has_uid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->uid()); } // optional string name = 2; if (has_name()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->name()); } // optional uint32 level = 3 [default = 1]; if (has_level()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->level()); } // optional uint32 style = 4; if (has_style()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->style()); } // optional uint32 winCount = 5; if (has_wincount()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->wincount()); } // optional uint32 loseCount = 6; if (has_losecount()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->losecount()); } // optional float winRate = 7; if (has_winrate()) { total_size += 1 + 4; } // optional .message.UserBasicInfo.EffectData effect = 8; if (has_effect()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->effect()); } } if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { // optional uint32 iconId = 9 [default = 6000]; if (has_iconid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->iconid()); } // optional uint32 successionWinCount = 10; if (has_successionwincount()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->successionwincount()); } // optional uint32 onceLong = 11; if (has_oncelong()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->oncelong()); } // optional uint64 maximum = 12; if (has_maximum()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt64Size( this->maximum()); } // optional uint64 totalTime = 13; if (has_totaltime()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt64Size( this->totaltime()); } // optional uint32 roundsPlayed = 14; if (has_roundsplayed()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->roundsplayed()); } // optional uint32 throwStones = 15; if (has_throwstones()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->throwstones()); } // optional uint32 thrownStones = 16; if (has_thrownstones()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->thrownstones()); } } if (_has_bits_[16 / 32] & (0xffu << (16 % 32))) { // optional uint32 colorCats = 17; if (has_colorcats()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->colorcats()); } // optional uint32 consumeGolds = 18; if (has_consumegolds()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumegolds()); } // optional uint32 consumeItems1 = 19; if (has_consumeitems1()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumeitems1()); } // optional uint32 consumeItems2 = 20; if (has_consumeitems2()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumeitems2()); } // optional uint32 consumeItems3 = 21; if (has_consumeitems3()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumeitems3()); } // optional uint32 consumeItems4 = 22; if (has_consumeitems4()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumeitems4()); } // optional uint32 golds = 23; if (has_golds()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->golds()); } // optional uint32 experience = 24; if (has_experience()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->experience()); } } if (_has_bits_[24 / 32] & (0xffu << (24 % 32))) { // optional uint32 maxExperience = 25 [default = 1]; if (has_maxexperience()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->maxexperience()); } } // repeated uint32 buyEquipFrame = 26; { int data_size = 0; for (int i = 0; i < this->buyequipframe_size(); i++) { data_size += ::google::protobuf::internal::WireFormatLite:: UInt32Size(this->buyequipframe(i)); } total_size += 2 * this->buyequipframe_size() + data_size; } GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = total_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; }