コード例 #1
0
char * show_profiler_one(char * pChar, uint32_t eid) {
    export_one_profiler_t * prof;   

    if (eid>EXPGW_EID_MAX_IDX) return pChar;
    if (eid != 0)
    {
      if (exportd_is_master()==0)
      {
	if (exportd_is_eid_match_with_instance(eid) ==0) return pChar;
      }  
    }  
    prof = export_profiler[eid];
    if (prof == NULL) return pChar;
        

    // Compute uptime for storaged process
    pChar += rozofs_string_append(pChar, "_______________________ EID = ");
    pChar += rozofs_u32_append(pChar,eid);
    pChar += rozofs_string_append(pChar, " _______________________ \n   procedure              |      count       |  time(us) |  cumulated time(us) |     bytes       |\n--------------------------+------------------+-----------+---------------------+-----------------+\n");
    SHOW_PROFILER_PROBE(ep_mount);
    SHOW_PROFILER_PROBE(ep_umount);
    SHOW_PROFILER_PROBE(ep_statfs);
    SHOW_PROFILER_PROBE(ep_lookup);
    SHOW_PROFILER_PROBE(ep_getattr);
    SHOW_PROFILER_PROBE(ep_setattr);
    SHOW_PROFILER_PROBE(ep_readlink);
    SHOW_PROFILER_PROBE(ep_mknod);
    SHOW_PROFILER_PROBE(ep_mkdir);
    SHOW_PROFILER_PROBE(ep_unlink);
    SHOW_PROFILER_PROBE(ep_rmdir);
    SHOW_PROFILER_PROBE(ep_symlink);
    SHOW_PROFILER_PROBE(ep_rename);
    SHOW_PROFILER_PROBE(ep_readdir);
    SHOW_PROFILER_PROBE_BYTE(ep_read_block);
    SHOW_PROFILER_PROBE_BYTE(ep_write_block);
    SHOW_PROFILER_PROBE(ep_link);
    SHOW_PROFILER_PROBE(ep_setxattr);
    SHOW_PROFILER_PROBE(ep_getxattr);
    SHOW_PROFILER_PROBE(ep_removexattr);
    SHOW_PROFILER_PROBE(ep_listxattr);

    if (short_display == 0) {
      SHOW_PROFILER_PROBE(export_lv1_resolve_entry);
      SHOW_PROFILER_PROBE(export_lv2_resolve_path);
      SHOW_PROFILER_PROBE(export_lookup_fid);
      SHOW_PROFILER_PROBE(export_update_files);
      SHOW_PROFILER_PROBE(export_update_blocks);
      SHOW_PROFILER_PROBE(export_stat);
      SHOW_PROFILER_PROBE(export_lookup);
      SHOW_PROFILER_PROBE(export_getattr);
      SHOW_PROFILER_PROBE(export_setattr);
      SHOW_PROFILER_PROBE(export_link);
      SHOW_PROFILER_PROBE(export_mknod);
      SHOW_PROFILER_PROBE(export_mkdir);
      SHOW_PROFILER_PROBE(export_unlink);
      SHOW_PROFILER_PROBE(export_rmdir);
      SHOW_PROFILER_PROBE(export_symlink);
      SHOW_PROFILER_PROBE(export_readlink);
      SHOW_PROFILER_PROBE(export_rename);
      SHOW_PROFILER_PROBE_BYTE(export_read);
      SHOW_PROFILER_PROBE(export_read_block);
      SHOW_PROFILER_PROBE(export_write_block);
      SHOW_PROFILER_PROBE(export_setxattr);
      SHOW_PROFILER_PROBE(export_getxattr);
      SHOW_PROFILER_PROBE(export_removexattr);
      SHOW_PROFILER_PROBE(export_listxattr);
      SHOW_PROFILER_PROBE(export_readdir);
      SHOW_PROFILER_PROBE(lv2_cache_put);
      SHOW_PROFILER_PROBE(lv2_cache_get);
      SHOW_PROFILER_PROBE(lv2_cache_del);
      SHOW_PROFILER_PROBE(volume_balance);
      SHOW_PROFILER_PROBE(volume_distribute);
      SHOW_PROFILER_PROBE(volume_stat);
      SHOW_PROFILER_PROBE(mdir_open);
      SHOW_PROFILER_PROBE(mdir_close);
      SHOW_PROFILER_PROBE(mdir_read_attributes);
      SHOW_PROFILER_PROBE(mdir_write_attributes);
      SHOW_PROFILER_PROBE(mreg_open);
      SHOW_PROFILER_PROBE(mreg_close);
      SHOW_PROFILER_PROBE(mreg_read_attributes);
      SHOW_PROFILER_PROBE(mreg_write_attributes);
      SHOW_PROFILER_PROBE(mreg_read_dist);
      SHOW_PROFILER_PROBE(mreg_write_dist);
      SHOW_PROFILER_PROBE(mslnk_open);
      SHOW_PROFILER_PROBE(mslnk_close);
      SHOW_PROFILER_PROBE(mslnk_read_attributes);
      SHOW_PROFILER_PROBE(mslnk_write_attributes);
      SHOW_PROFILER_PROBE(mslnk_read_link);
      SHOW_PROFILER_PROBE(mslnk_write_link);
    }
    SHOW_PROFILER_PROBE(get_mdirentry);
    SHOW_PROFILER_PROBE(put_mdirentry);
    SHOW_PROFILER_PROBE(del_mdirentry);
    SHOW_PROFILER_PROBE(list_mdirentries);
    SHOW_PROFILER_PROBE(gw_invalidate);
    SHOW_PROFILER_PROBE(gw_invalidate_all);
    SHOW_PROFILER_PROBE(gw_configuration);
    SHOW_PROFILER_PROBE(gw_poll);
    if (short_display == 0) {
      SHOW_PROFILER_PROBE(ep_configuration);
      SHOW_PROFILER_PROBE(ep_conf_gateway);
      SHOW_PROFILER_PROBE(ep_poll);
      SHOW_PROFILER_PROBE(export_clearclient_flock);
      SHOW_PROFILER_PROBE(export_clearowner_flock);
      SHOW_PROFILER_PROBE(export_set_file_lock);
      SHOW_PROFILER_PROBE(export_get_file_lock);
      SHOW_PROFILER_PROBE(export_poll_file_lock);
      SHOW_PROFILER_PROBE(export_poll_owner_lock);
    }  
    SHOW_PROFILER_PROBE(ep_clearclient_flock);
    SHOW_PROFILER_PROBE(ep_clearowner_flock);
    SHOW_PROFILER_PROBE(ep_set_file_lock);
    SHOW_PROFILER_PROBE(ep_get_file_lock);
    SHOW_PROFILER_PROBE(ep_poll_file_lock);
    SHOW_PROFILER_PROBE(ep_geo_poll);
    SHOW_PROFILER_PROBE(quota_set);
    SHOW_PROFILER_PROBE(quota_get);
    SHOW_PROFILER_PROBE(quota_setinfo);
    if (short_display == 0) {
      SHOW_PROFILER_PROBE(dir_wr_on_time);
      SHOW_PROFILER_PROBE(dir_wr_on_check);
      SHOW_PROFILER_PROBE(dir_wr_on_lru);
    }  
    
    return pChar;
}
コード例 #2
0
ファイル: rozofs_fuse_thread.c プロジェクト: ptulpen/test1234
/*
** Create the threads that will handle all the disk requests

* @param hostname    storio hostname (for tests)
* @param nb_threads  number of threads to create
*  
* @retval 0 on success -1 in case of error
*/
int rozofs_fuse_thread_create(char * hostname, int nb_threads, int instance_id) {
   int                        i;
   int                        err;
   pthread_attr_t             attr;
   rozofs_fuse_thread_ctx_t * thread_ctx_p;
   char                       socketName[128];

   /*
   ** clear the thread table
   */
   memset(rozofs_fuse_thread_ctx_tb,0,sizeof(rozofs_fuse_thread_ctx_tb));
   /*
   ** create the common socket to receive requests on
   */
   char * pChar = socketName;
   pChar += rozofs_string_append(pChar,ROZOFS_SOCK_FAMILY_FUSE_NORTH);
   *pChar++ = '_';
   pChar += rozofs_u32_append(pChar,instance_id);
   *pChar++ = '_';  
   pChar += rozofs_string_append(pChar,hostname);
   af_unix_fuse_socket_ref = af_unix_fuse_sock_create_internal(socketName,1024*32);
   if (af_unix_fuse_socket_ref < 0) {
      fatal("af_unix_fuse_thread_create af_unix_fuse_sock_create_internal(%s) %s",socketName,strerror(errno));
      return -1;   
   }
   /*
   ** Now create the threads
   */
   thread_ctx_p = rozofs_fuse_thread_ctx_tb;
   for (i = 0; i < nb_threads ; i++) {
   
     thread_ctx_p->hostname = hostname;
     /*
     ** create the thread specific socket to send the response from 
     */
     pChar = socketName;
     pChar += rozofs_string_append(pChar,ROZOFS_SOCK_FAMILY_FUSE_NORTH);
     *pChar++ = '_';
     pChar += rozofs_u32_append(pChar,instance_id);
     *pChar++ = '_';  
     pChar += rozofs_string_append(pChar,hostname);
     *pChar++ = '_'; 
     pChar += rozofs_u32_append(pChar,i);
     thread_ctx_p->sendSocket = af_unix_fuse_sock_create_internal(socketName,1024*32);
     if (thread_ctx_p->sendSocket < 0) {
	fatal("af_unix_fuse_thread_create af_unix_fuse_sock_create_internal(%s) %s",socketName, strerror(errno));
	return -1;   
     }   
   
     err = pthread_attr_init(&attr);
     if (err != 0) {
       fatal("af_unix_fuse_thread_create pthread_attr_init(%d) %s",i,strerror(errno));
       return -1;
     }  

     thread_ctx_p->thread_idx = i;
     err = pthread_create(&thread_ctx_p->thrdId,&attr,rozofs_fuse_thread,thread_ctx_p);
     if (err != 0) {
       fatal("af_unix_fuse_thread_create pthread_create(%d) %s",i, strerror(errno));
       return -1;
     }  
     
     thread_ctx_p++;
  }
  return 0;
}