Branch: Tag:

2001-05-26

2001-05-26 14:59:01 by Per Hedbor <ph@opera.com>

Better looking debug printouts and threaded sync()

Rev: lib/modules/Search.pmod/Database.pmod/MySQL.pike:1.19
Rev: lib/modules/Search.pmod/Filter.pmod/HTML.pmod:1.3
Rev: lib/modules/Search.pmod/Indexer.pmod:1.4

8:    if(!filter)    error("No indexer for content type "+content_type);    - // int h = gethrtime(); -  +  int h = gethrtime();    Search.Filter.Base.Output filteroutput=    filter->filter(uri, data, content_type); -  +  int ms = (gethrtime()-h); +  werror("filter : %5dms (%4.1fMb/s)\n", ms/1000, +  (strlen(data)/1024.0/1024.0)/(ms/1000000.0) );    - // werror("filter: %dms\n", (gethrtime()-h)/1000 ); -  +  h = gethrtime();    db->remove_document( uri, language ); -  +  werror("remove : %5dms\n", (gethrtime()-h)/1000 );    // Tokenize and normalize all the non-anchor fields       foreach(indices(filteroutput->fields), string field)    {    if( strlen(filteroutput->fields[field] ) )    { - // h = gethrtime(); -  string q =Search.Utils.normalize(filteroutput->fields[field]); - // werror("normalize: %dms\n", (gethrtime()-h)/1000 ); -  - // h = gethrtime(); -  array words = Search.Utils.tokenize(q); - // werror("tokenize: %dms\n", (gethrtime()-h)/1000 ); -  db->insert_words(uri, language, field, words); +  h = gethrtime(); +  array words=Search.Utils.tokenize( +  Search.Utils.normalize(filteroutput->fields[field])); +  if( field == "body" ) +  { +  ms = (gethrtime()-h); +  werror("tokenize: %5dms (%4.1fMb/s)\n", ms/1000, +  (strlen(filteroutput->fields[field])/1024.0/1024.0) +  /(ms/1000000.0) );    } -  +  h = gethrtime(); +  db->insert_words(uri, language, field,words ); +  if( field == "body" ) +  { +  ms = (gethrtime()-h); +  werror("insert : %5dms (%4.1fMb/s)\n", ms/1000, +  (strlen(filteroutput->fields[field])/1024.0/1024.0) +  /(ms/1000000.0) );    } -  +  } +  }    // Tokenize any anchor fields -  +  h = gethrtime();    int source_hash=hash((string)uri)&0xf;    foreach(indices(filteroutput->uri_anchors || ({ })), string link_uri)    {