Page Speed Optimization Libraries  1.2.24.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions
net_instaweb::SharedMemRefererStatistics Class Reference

#include "shared_mem_referer_statistics.h"

Inheritance diagram for net_instaweb::SharedMemRefererStatistics:
net_instaweb::HashedRefererStatistics

List of all members.

Public Member Functions

 SharedMemRefererStatistics (size_t number_of_strings, size_t average_string_length, AbstractSharedMem *shm_runtime, const GoogleString &filename_prefix, const GoogleString &filename_suffix)
 All inputs are passed to SharedDynamicStringMap constructor.
bool InitSegment (bool parent, MessageHandler *message_handler)
 All inputs are passed to SharedDynamicStringMap method.
void LogPageRequestWithoutReferer (const GoogleUrl &target)
void LogPageRequestWithReferer (const GoogleUrl &target, const GoogleUrl &referer)
void LogResourceRequestWithReferer (const GoogleUrl &target, const GoogleUrl &referer)
int GetNumberOfVisitsForUrl (const GoogleUrl &url)
int GetNumberOfReferencesFromUrlToPage (const GoogleUrl &from_url, const GoogleUrl &to_url)
int GetNumberOfReferencesFromUrlToDivLocation (const GoogleUrl &from_url, const GoogleString &div_location)
int GetNumberOfReferencesFromUrlToResource (const GoogleUrl &from_url, const GoogleUrl &resource_url)
void GlobalCleanup (MessageHandler *message_handler)
 Calls shared_dynamic_string_map_->GlobalCleanup(message_handler)
void DumpFast (Writer *writer, MessageHandler *message_handler)
void DumpSimple (Writer *writer, MessageHandler *message_handler)
void DumpOrganized (Writer *writer, MessageHandler *message_handler)

Static Public Member Functions

static GoogleString GetDivLocationFromUrl (const GoogleUrl &url)
 Extracts the div_location from the Url.

Static Public Attributes

static const char kParamName []
 The name for special div location query parameter.

Protected Member Functions

virtual GoogleString GetEntryStringForUrlString (const StringPiece &url_string) const
 Given a Url string, produces the corresponding ready-for-storage string.
virtual GoogleString GetEntryStringForDivLocation (const StringPiece &div_location) const

Detailed Description

This class handles persistent memory of referer statistics by wrapping a SharedDynamicStringMap by encoding references into string map entries and parsing these entries later. GetEntryStringForUrl and GetDivLocationEntryStringForUrl can be overridden to tweak encodings of strings (say, if you want information to be hashed).


Member Function Documentation

void net_instaweb::SharedMemRefererStatistics::DumpFast ( Writer writer,
MessageHandler message_handler 
)

Various methods of dumping information, that go from hard to understand and cheap to well-organized and expensive: 1. DumpFast writes SharedDynamicStringMap information in the order it was provided without parsing or decoding string entries (see Dump method of SharedDynamicStringMap)

Example: http://www.example.com/news: 1 http://www.example.com/news/us: 1 http://www.example.com/news/us phttp://www.example.com/news: 1 1.1.2.0 dhttp://www.example.com/news: 1 http://img.ex.com/news_us.jpg rhttp://www.example.com/news/us: 1

2. DumpSimple writes SharedDynamicStringMap information in the order it was provided, but it parses and decodes string entries into a more readable format (see DecodeEntry method below)

Example: http://www.example.com/news refered div location 1.1.2.0 : 1 http://www.example.com/news/us refered resource http://img.ex.com/news_us.jpg : 1 http://www.example.com/news visits: 1 http://www.example.com/news/us visits: 1 http://www.example.com/news refered page http://www.example.com/news/us : 1

3. DumpOrganized writes SharedDynamicStringMap information, grouped by referers, in alphabetical order.

Example: http://www.example.com/news visits: 1 http://www.example.com/news refered: div location 1.1.2.0 : 1 page http://ww.example.com/news/us : 1 http://www.example.com/news/us visits: 1 http://www.example.com/news/us refered: resource http://img.ex.com/news_us.jpg

virtual GoogleString net_instaweb::SharedMemRefererStatistics::GetEntryStringForDivLocation ( const StringPiece &  div_location) const [protected, virtual]

Given a div location (string), produces the corresponding ready-for-storage string

Reimplemented in net_instaweb::HashedRefererStatistics.

The first LogPageRequest method is to be used when there is no referer, and logs only the page visit. The second logs the visit and the referral. LogResourceRequest logs only the referral.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines