void btCollisionWorld::performDiscreteCollisionDetection() { btDispatcherInfo& dispatchInfo = getDispatchInfo(); BEGIN_PROFILE("perform Broadphase Collision Detection"); //update aabb (of all moved objects) btVector3 aabbMin,aabbMax; for (int i=0;i<m_collisionObjects.size();i++) { m_collisionObjects[i]->getCollisionShape()->getAabb(m_collisionObjects[i]->getWorldTransform(),aabbMin,aabbMax); m_broadphasePairCache->setAabb(m_collisionObjects[i]->getBroadphaseHandle(),aabbMin,aabbMax); } m_broadphasePairCache->calculateOverlappingPairs(m_dispatcher1); END_PROFILE("perform Broadphase Collision Detection"); BEGIN_PROFILE("performDiscreteCollisionDetection"); btDispatcher* dispatcher = getDispatcher(); if (dispatcher) dispatcher->dispatchAllCollisionPairs(m_broadphasePairCache->getOverlappingPairCache(),dispatchInfo,m_dispatcher1); END_PROFILE("performDiscreteCollisionDetection"); }
int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) { int result; START_PROFILE(syscall_fchmod); /* * We need to do this due to the fact that the default POSIX ACL * chmod modifies the ACL *mask* for the group owner, not the * group owner bits directly. JRA. */ { int saved_errno = errno; /* We might get ENOSYS */ if ((result = SMB_VFS_FCHMOD_ACL(fsp, fd, mode)) == 0) { END_PROFILE(syscall_fchmod); return result; } /* Error - return the old errno. */ errno = saved_errno; } #if defined(HAVE_FCHMOD) result = fchmod(fd, mode); #else result = -1; errno = ENOSYS; #endif END_PROFILE(syscall_fchmod); return result; }
LRESULT CVariablePage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { ATLASSERT(m_piCurrentClass); START_PROFILE(VarInit); CreateControls(); m_DDXManager.SetGlobalParams(m_hWnd, m_pModifications, m_pResManager); CRect r; m_Variables.GetClientRect(r); m_Variables.InsertColumn(0, _T("ID"), LVCFMT_LEFT, m_WindowSettings.m_VariableWidth, 0); m_Variables.InsertColumn(1, _T("Variable"), LVCFMT_LEFT, r.Width() - m_WindowSettings.m_VariableWidth - 5, 1); m_Variables.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); START_PROFILE(VarDlg); for (size_t i = 0; i < m_pClassVector->GetCount(); i++) { VSClass* pCurClass = (*m_pClassVector)[i]; if (!m_bOnlyDlgs || (pCurClass->IsDialog() && !(pCurClass->m_DialogID.IsEmpty()))) { int iItem = m_Classes.AddString(pCurClass->Name); m_Classes.SetItemData(iItem, i); } } END_PROFILE(VarDlg, _T("CVariablePage::OnInitDialog check dialog classes")); m_Classes.SetCurSel(0); m_ToolbarImgList.CreateFromImage(IDB_BITMAP_DDX, 18, 1, RGB(197, 200,201), IMAGE_BITMAP, LR_CREATEDIBSECTION); InitToolTip(); END_PROFILE(VarInit, _T("CVariablePage::OnInitDialog")); return 0; }
/**************************************************************************** reply to a sendtxt ****************************************************************************/ int reply_sendtxt(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) { int len; int outsize = 0; char *msg; START_PROFILE(SMBsendtxt); if (! (*lp_msg_command())) { END_PROFILE(SMBsendtxt); return(ERROR_DOS(ERRSRV,ERRmsgoff)); } outsize = set_message(outbuf,0,0,True); msg = smb_buf(inbuf) + 1; len = SVAL(msg,0); len = MIN(len,sizeof(msgbuf)-msgpos); memcpy(&msgbuf[msgpos],msg+2,len); msgpos += len; DEBUG( 3, ( "SMBsendtxt\n" ) ); END_PROFILE(SMBsendtxt); return(outsize); }
/**************************************************************************** reply to a sendstrt ****************************************************************************/ int reply_sendstrt(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) { int outsize = 0; char *p; START_PROFILE(SMBsendstrt); if (! (*lp_msg_command())) { END_PROFILE(SMBsendstrt); return(ERROR_DOS(ERRSRV,ERRmsgoff)); } outsize = set_message(outbuf,1,0,True); memset(msgbuf,'\0',sizeof(msgbuf)); msgpos = 0; p = smb_buf(inbuf)+1; p += srvstr_pull_buf(inbuf, msgfrom, p, sizeof(msgfrom), STR_TERMINATE) + 1; p += srvstr_pull_buf(inbuf, msgto, p, sizeof(msgto), STR_TERMINATE) + 1; DEBUG( 3, ( "SMBsendstrt (from %s to %s)\n", msgfrom, msgto ) ); END_PROFILE(SMBsendstrt); return(outsize); }
int vfswrap_chmod(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) { int result; START_PROFILE(syscall_chmod); /* * We need to do this due to the fact that the default POSIX ACL * chmod modifies the ACL *mask* for the group owner, not the * group owner bits directly. JRA. */ { int saved_errno = errno; /* We might get ENOSYS */ if ((result = SMB_VFS_CHMOD_ACL(conn, path, mode)) == 0) { END_PROFILE(syscall_chmod); return result; } /* Error - return the old errno. */ errno = saved_errno; } result = chmod(path, mode); END_PROFILE(syscall_chmod); return result; }
void Tripod::AdvancePreAttack() { START_PROFILE(g_app->m_profiler, "AdvancePreAttack"); // Exit if we haven't come to a stop yet if (m_vel.Mag() > 0.05f) { END_PROFILE(g_app->m_profiler, "AdvancePreAttack"); return; } m_targetHoverHeight = ATTACK_HOVER_HEIGHT; // See if we have achieved a full crouch yet float height = m_pos.y - g_app->m_location->m_landscape.m_heightMap->GetValue(m_pos.x, m_pos.z); if (height < ATTACK_HOVER_HEIGHT + 0.5f) { m_mode = ModeAttacking; m_modeStartTime = g_gameTime; } // Blend into attack orientation Vector3 desiredUp = CalcAttackUpVector(); float factor1 = 0.8f * SERVER_ADVANCE_PERIOD; float factor2 = 1.0f - factor1; m_up = factor1 * desiredUp + factor2 * m_up; Vector3 right = m_up ^ m_front; m_front = right ^ m_up; m_front.Normalise(); END_PROFILE(g_app->m_profiler, "AdvancePreAttack"); }
void sync_browse_lists(struct work_record *work, char *name, int nm_type, struct in_addr ip, bool local, bool servers) { struct sync_record *s; static int counter; START_PROFILE(sync_browse_lists); /* Check we're not trying to sync with ourselves. This can happen if we are a domain *and* a local master browser. */ if (ismyip_v4(ip)) { done: END_PROFILE(sync_browse_lists); return; } s = SMB_MALLOC_P(struct sync_record); if (!s) goto done; ZERO_STRUCTP(s); unstrcpy(s->workgroup, work->work_group); unstrcpy(s->server, name); s->ip = ip; if (asprintf(&s->fname, "%s/sync.%d", lp_lockdir(), counter++) < 0) { SAFE_FREE(s); goto done; } /* Safe to use as 0 means no size change. */ all_string_sub(s->fname,"//", "/", 0); DLIST_ADD(syncs, s); /* the parent forks and returns, leaving the child to do the actual sync and call END_PROFILE*/ CatchChild(); if ((s->pid = sys_fork())) return; BlockSignals( False, SIGTERM ); DEBUG(2,("Initiating browse sync for %s to %s(%s)\n", work->work_group, name, inet_ntoa(ip))); fp = x_fopen(s->fname,O_WRONLY|O_CREAT|O_TRUNC, 0644); if (!fp) { END_PROFILE(sync_browse_lists); _exit(1); } sync_child(name, nm_type, work->work_group, ip, local, servers, s->fname); x_fclose(fp); END_PROFILE(sync_browse_lists); _exit(0); }
void Tripod::AdvanceWalk() { START_PROFILE(g_app->m_profiler, "AdvanceWalk"); // Consider mode switch { float timeSinceAttack = g_gameTime - m_modeStartTime; if (timeSinceAttack > 10.0f + ATTACK_DURATION) { WorldObjectId targetId = FindEntityToAttack(); if (targetId.IsValid()) { Entity *target = g_app->m_location->GetEntity(targetId); m_attackTarget = target->m_pos; m_mode = ModePreAttack; m_modeStartTime = g_gameTime; END_PROFILE(g_app->m_profiler, "AdvanceWalk"); return; } } } // Consider choosing a different nav dest if (syncrand() % 40 == 1) { m_navData.m_targetPos = ChooseDestination(); } // Hover m_targetHoverHeight = STATIONARY_HOVER_HEIGHT - fabsf(m_speed) * HOVER_LOWER_WITH_SPEED_FACTOR; // Navigate DoNavigation(); // Fall { bool allOnGround = m_legs[0]->m_foot.m_state == EntityFoot::OnGround && m_legs[1]->m_foot.m_state == EntityFoot::OnGround && m_legs[2]->m_foot.m_state == EntityFoot::OnGround; if (!allOnGround) { DoFallForTwoLegs(); } else { m_bodyVel.Zero(); m_front.HorizontalAndNormalise(); m_up = g_upVector; } } END_PROFILE(g_app->m_profiler, "AdvanceWalk"); }
SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) { SMB_OFF_T result = 0; START_PROFILE(syscall_lseek); /* Cope with 'stat' file opens. */ if (filedes != -1) result = sys_lseek(filedes, offset, whence); /* * We want to maintain the fiction that we can seek * on a fifo for file system purposes. This allows * people to set up UNIX fifo's that feed data to Windows * applications. JRA. */ if((result == -1) && (errno == ESPIPE)) { result = 0; errno = 0; } END_PROFILE(syscall_lseek); return result; }
int vfswrap_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) { int result; BOOL has_dacl = False; START_PROFILE(syscall_mkdir); if (lp_inherit_acls(SNUM(conn)) && (has_dacl = directory_has_default_acl(conn, parent_dirname(path)))) mode = 0777; result = mkdir(path, mode); if (result == 0 && !has_dacl) { /* * We need to do this as the default behavior of POSIX ACLs * is to set the mask to be the requested group permission * bits, not the group permission bits to be the requested * group permission bits. This is not what we want, as it will * mess up any inherited ACL bits that were set. JRA. */ int saved_errno = errno; /* We may get ENOSYS */ if ((SMB_VFS_CHMOD_ACL(conn, path, mode) == -1) && (errno == ENOSYS)) errno = saved_errno; } END_PROFILE(syscall_mkdir); return result; }
static int vfswrap_ntimes(vfs_handle_struct *handle, const char *path, const struct timespec ts[2]) { int result; START_PROFILE(syscall_ntimes); #if defined(HAVE_UTIMES) { struct timeval tv[2]; tv[0] = convert_timespec_to_timeval(ts[0]); tv[1] = convert_timespec_to_timeval(ts[1]); result = utimes(path, tv); } #elif defined(HAVE_UTIME) { struct utimbuf times; times.actime = convert_timespec_to_time_t(ts[0]); times.modtime = convert_timespec_to_time_t(ts[1]); result = utime(path, times); } #else errno = ENOSYS; result = -1; #endif END_PROFILE(syscall_ntimes); return result; }
static uint64_t onefs_get_alloc_size(struct vfs_handle_struct *handle, files_struct *fsp, const SMB_STRUCT_STAT *sbuf) { uint64_t result; START_PROFILE(syscall_get_alloc_size); if(S_ISDIR(sbuf->st_mode)) { result = 0; goto out; } /* Just use the file size since st_blocks is unreliable on OneFS. */ result = get_file_size_stat(sbuf); if (fsp && fsp->initial_allocation_size) result = MAX(result,fsp->initial_allocation_size); result = smb_roundup(handle->conn, result); out: END_PROFILE(syscall_get_alloc_size); return result; }
void SoundSystem::TriggerEvent( SoundObjectId _objId, char *_eventName ) { if( !m_channels ) return; START_PROFILE("TriggerEvent"); char *objectType = m_interface->GetObjectType(_objId); if( objectType ) { SoundEventBlueprint *seb = m_blueprints.GetBlueprint(objectType); if( seb ) { for( int i = 0; i < seb->m_events.Size(); ++i ) { SoundInstanceBlueprint *sib = seb->m_events[i]; if( stricmp( sib->m_eventName, _eventName ) == 0 ) { Vector3<float> pos, vel; m_interface->GetObjectPosition( _objId, pos, vel ); SoundInstance *instance = new SoundInstance(); instance->Copy( sib->m_instance ); instance->m_objIds.PutData( _objId ); instance->m_pos = pos; instance->m_vel = vel; bool success = InitialiseSound ( instance ); if( !success ) ShutdownSound ( instance ); } } } } END_PROFILE("TriggerEvent"); }
Vector2 Tripod::ChooseDestination() { START_PROFILE(g_app->m_profiler, "ChooseDest"); int numFound; WorldObjectId *enemies = g_app->m_location->m_entityGrid->GetEnemies(m_pos.x, m_pos.z, NAVIGATION_SEARCH_RADIUS, &numFound, m_id.GetTeamId()); Vector2 pos; if (numFound == 0) { pos = m_pos; pos.x += syncsfrand(300.0f); pos.y += syncsfrand(300.0f); } else { int i = syncrand() % numFound; Entity *targetEnemy = g_app->m_location->GetEntity(enemies[i]); pos = targetEnemy->m_pos; pos.x += syncsfrand(100.0f); pos.y += syncsfrand(100.0f); } END_PROFILE(g_app->m_profiler, "ChooseDest"); return pos; }
void SoundSystem::TriggerEvent( char *_type, char *_eventName, Vector3<float> const &_pos ) { if( !m_channels ) return; START_PROFILE("TriggerEvent"); SoundEventBlueprint *seb = m_blueprints.GetBlueprint(_type); if( seb ) { for( int i = 0; i < seb->m_events.Size(); ++i ) { SoundInstanceBlueprint *sib = seb->m_events[i]; if( stricmp( sib->m_eventName, _eventName ) == 0 ) { SoundInstance *instance = new SoundInstance(); instance->Copy( sib->m_instance ); instance->m_pos = _pos; bool success = InitialiseSound ( instance ); if( !success ) ShutdownSound ( instance ); } } } END_PROFILE("TriggerEvent"); }
WorldObjectId Tripod::FindEntityToAttack() { START_PROFILE(g_app->m_profiler, "FindEntityToA"); WorldObjectId id; int numFound; WorldObjectId *enemies = g_app->m_location->m_entityGrid->GetEnemies(m_pos.x, m_pos.z, ATTACK_SEARCH_RADIUS, &numFound, m_id.GetTeamId()); int nearest = -1; float nearestDistSqrd = FLT_MAX; for (int i = 0; i < numFound; ++i) { Entity *entity = g_app->m_location->GetEntity(enemies[i]); float deltaX = entity->m_pos.x - m_pos.x; float deltaY = entity->m_pos.z - m_pos.z; float distSqrd = deltaX * deltaX + deltaY * deltaY; if (distSqrd < nearestDistSqrd) { nearestDistSqrd = distSqrd; nearest = i; } } if (nearest != -1) { id = enemies[nearest]; } END_PROFILE(g_app->m_profiler, "FindEntityToA"); return id; }
void LandscapeRenderer::Render() { if (m_verts.Size() <= 0) return; g_app->m_location->SetupFog(); glEnable (GL_FOG); START_PROFILE( "Render Landscape Main"); switch (m_renderMode) { case RenderModeDisplayList: { int id = g_app->m_resource->GetDisplayList(MAIN_DISPLAY_LIST_NAME); AppDebugAssert(id != -1); glCallList(id); } break; default: RenderMainSlow(); break; } END_PROFILE( "Render Landscape Main"); int landscapeDetail = 1;//g_prefsManager->GetInt( "RenderLandscapeDetail", 1 ); if( landscapeDetail < 4 ) { START_PROFILE( "Render Landscape Overlay"); switch (m_renderMode) { case RenderModeDisplayList: { int id = g_app->m_resource->GetDisplayList(OVERLAY_DISPLAY_LIST_NAME); AppDebugAssert(id != -1); glCallList(id); } break; default: RenderOverlaySlow(); ; } END_PROFILE( "Render Landscape Overlay"); } glDisable (GL_FOG); }
static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 share_mode) { START_PROFILE(syscall_kernel_flock); kernel_flock(fd, share_mode); END_PROFILE(syscall_kernel_flock); return 0; }
long vfswrap_telldir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { long result; START_PROFILE(syscall_telldir); result = sys_telldir(dirp); END_PROFILE(syscall_telldir); return result; }
int vfswrap_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times) { int result; START_PROFILE(syscall_utime); result = utime(path, times); END_PROFILE(syscall_utime); return result; }
SMB_STRUCT_DIR *vfswrap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { SMB_STRUCT_DIR *result; START_PROFILE(syscall_opendir); result = sys_opendir(fname); END_PROFILE(syscall_opendir); return result; }
BOOL vfswrap_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, SEC_DESC *psd) { BOOL result; START_PROFILE(set_nt_acl); result = set_nt_acl(fsp, security_info_sent, psd); END_PROFILE(set_nt_acl); return result; }
size_t vfswrap_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info, SEC_DESC **ppdesc) { size_t result; START_PROFILE(get_nt_acl); result = get_nt_acl(fsp, security_info, ppdesc); END_PROFILE(get_nt_acl); return result; }
char *vfswrap_realpath(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *resolved_path) { char *result; START_PROFILE(syscall_realpath); result = sys_realpath(path, resolved_path); END_PROFILE(syscall_realpath); return result; }
int vfswrap_mknod(vfs_handle_struct *handle, connection_struct *conn, const char *pathname, mode_t mode, SMB_DEV_T dev) { int result; START_PROFILE(syscall_mknod); result = sys_mknod(pathname, mode, dev); END_PROFILE(syscall_mknod); return result; }
int vfswrap_link(vfs_handle_struct *handle, connection_struct *conn, const char *oldpath, const char *newpath) { int result; START_PROFILE(syscall_link); result = sys_link(oldpath, newpath); END_PROFILE(syscall_link); return result; }
int vfswrap_readlink(vfs_handle_struct *handle, connection_struct *conn, const char *path, char *buf, size_t bufsiz) { int result; START_PROFILE(syscall_readlink); result = sys_readlink(path, buf, bufsiz); END_PROFILE(syscall_readlink); return result; }
BOOL vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) { BOOL result; START_PROFILE(syscall_fcntl_getlock); result = fcntl_getlock(fd, poffset, pcount, ptype, ppid); END_PROFILE(syscall_fcntl_getlock); return result; }
BOOL vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) { BOOL result; START_PROFILE(syscall_fcntl_lock); result = fcntl_lock(fd, op, offset, count, type); END_PROFILE(syscall_fcntl_lock); return result; }