@@ -100,8 +100,6 @@ libsinsp::state::static_struct::field_infos sinsp_threadinfo::static_fields() co
100100 define_static_field (ret, this , m_pgid, " pgid" );
101101 define_static_field (ret, this , m_pidns_init_start_ts, " pidns_init_start_ts" );
102102 define_static_field (ret, this , m_root, " root" );
103- // m_program_hash
104- // m_program_hash_scripts
105103 define_static_field (ret, this , m_tty, " tty" );
106104 // m_category
107105 // m_clone_ts
@@ -145,8 +143,6 @@ void sinsp_threadinfo::init() {
145143 m_lastevent_fd = 0 ;
146144 m_last_latency_entertime = 0 ;
147145 m_latency = 0 ;
148- m_program_hash = 0 ;
149- m_program_hash_scripts = 0 ;
150146 m_lastevent_data = NULL ;
151147 m_parent_loop_detected = false ;
152148 m_tty = 0 ;
@@ -203,57 +199,6 @@ void sinsp_threadinfo::fix_sockets_coming_from_proc() {
203199 });
204200}
205201
206- #define STR_AS_NUM_JAVA 0x6176616a
207- #define STR_AS_NUM_RUBY 0x79627572
208- #define STR_AS_NUM_PERL 0x6c726570
209- #define STR_AS_NUM_NODE 0x65646f6e
210-
211- #define MAX_PROG_HASH_LEN 1024
212-
213- void sinsp_threadinfo::compute_program_hash () {
214- auto curr_hash = std::hash<std::string>()(m_exe);
215- hash_combine (curr_hash, m_container_id);
216- auto rem_len = MAX_PROG_HASH_LEN - (m_exe.size () + m_container_id.size ());
217-
218- //
219- // By default, the scripts hash is just exe+container
220- //
221- m_program_hash_scripts = curr_hash;
222-
223- //
224- // The program hash includes the arguments as well
225- //
226- for (auto arg = m_args.begin (); arg != m_args.end () && rem_len > 0 ; ++arg) {
227- if (arg->size () >= rem_len) {
228- auto partial_str = arg->substr (0 , rem_len);
229- hash_combine (curr_hash, partial_str);
230- break ;
231- }
232-
233- hash_combine (curr_hash, *arg);
234- rem_len -= arg->size ();
235- }
236- m_program_hash = curr_hash;
237-
238- //
239- // For some specific processes (essentially the scripting languages)
240- // we include the arguments in the scripts hash as well
241- //
242- if (m_comm.size () == 4 ) {
243- uint32_t ncomm;
244- memcpy (&ncomm, m_comm.c_str (), 4 );
245-
246- if (ncomm == STR_AS_NUM_JAVA || ncomm == STR_AS_NUM_RUBY || ncomm == STR_AS_NUM_PERL ||
247- ncomm == STR_AS_NUM_NODE) {
248- m_program_hash_scripts = m_program_hash;
249- }
250- } else if (m_comm.size () >= 6 ) {
251- if (m_comm.substr (0 , 6 ) == " python" ) {
252- m_program_hash_scripts = m_program_hash;
253- }
254- }
255- }
256-
257202void sinsp_threadinfo::add_fd_from_scap (scap_fdinfo* fdi) {
258203 auto newfdi = m_inspector->build_fdinfo ();
259204 bool do_add = true ;
@@ -1477,7 +1422,6 @@ const std::shared_ptr<sinsp_threadinfo>& sinsp_thread_manager::add_thread(
14771422 " adding entry with incompatible dynamic defs to of file descriptor sub-table" );
14781423 }
14791424
1480- tinfo_shared_ptr->compute_program_hash ();
14811425 if (m_sinsp_stats_v2 != nullptr ) {
14821426 m_sinsp_stats_v2->m_n_added_threads ++;
14831427 }
0 commit comments